Skip to content

Commit

Permalink
feat: gitlab caching
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Sep 23, 2018
1 parent 323582f commit 4f858dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd_pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ func pull(opts *pullOptions) error {
Page: 1,
},
}

var lastEntry Issue
if err := db.Where("repo_url = ?", repo.Canonical()).Order("updated_at desc").First(&lastEntry).Error; err == nil {
opts.UpdatedAfter = &lastEntry.UpdatedAt
}

for {
issues, resp, err := client.Issues.ListProjectIssues(projectID, opts)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func FromGitLabIssue(input *gitlab.Issue) *Issue {
repoURL = strings.Replace(input.WebURL, fmt.Sprintf("/issues/%d", input.IID), "", -1)
}
issue := &Issue{
CreatedAt: *input.CreatedAt,
UpdatedAt: *input.UpdatedAt,
Provider: GitLabProvider,
GitLab: input,
Number: input.IID,
Expand Down

0 comments on commit 4f858dc

Please sign in to comment.