From 4f858dcc9f0f24b86e4f8334d57c409d0862dea3 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Sun, 23 Sep 2018 14:46:14 +0200 Subject: [PATCH] feat: gitlab caching --- cmd_pull.go | 6 ++++++ issue.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/cmd_pull.go b/cmd_pull.go index fffb0886c..a523e24a7 100644 --- a/cmd_pull.go +++ b/cmd_pull.go @@ -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 { diff --git a/issue.go b/issue.go index 6301b2ffe..cb63e597b 100644 --- a/issue.go +++ b/issue.go @@ -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,