Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions backend/plugins/gitlab/tasks/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,19 @@ func GetMergeRequestsIterator(taskCtx plugin.SubTaskContext, apiCollector *api.S
data.Options.ProjectId, data.Options.ConnectionId,
),
}
if apiCollector != nil {
if apiCollector.GetSince() != nil {
clauses = append(clauses, dal.Where("gitlab_updated_at > ?", *apiCollector.GetSince()))
}
}
if apiCollector != nil
{
if apiCollector.GetSince() != nil {
// Filter by the LATER of gitlab_updated_at or commit_updated_at.
// Using only gitlab_updated_at misses MRs where new commits were pushed
// without the MR itself being updated (e.g. force-pushed commits).
// COALESCE handles MRs with no recorded commit_updated_at.
clauses = append(clauses, dal.Where(
`GREATEST(gmr.gitlab_updated_at, COALESCE(gmr.commit_updated_at, gmr.gitlab_updated_at)) > ?`,
*apiCollector.GetSince(),
))
}
}
// construct the input iterator
cursor, err := db.Cursor(clauses...)
if err != nil {
Expand Down