Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
*.swp
*.swo
*.orig

.DS_Store
dist/
11 changes: 11 additions & 0 deletions internal/mergequeue/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,13 @@ func (a *Coordinator) processPullRequestEvent(ctx context.Context, logger *zap.L
)
return
}
// If pr == nil, it means that the queue has already been deleted earlier by another event.
if pr == nil {
logger.Warn(
"PR already dequeued or queue non-existent",
)
return
}

if ev.PullRequest.GetMerged() {
metrics.RecordTimeToMerge(time.Since(pr.EnqueuedAt), owner, repo)
Expand Down Expand Up @@ -926,6 +933,10 @@ func (a *Coordinator) Dequeue(_ context.Context, baseBranch *BaseBranch, prNumbe

pr, err := q.Dequeue(prNumber, setPendingStatusState)
if err != nil {
// If there is a queue but no PR in it, this may also be a duplicate.
if errors.Is(err, ErrNotFound) {
return nil, nil
}
return nil, fmt.Errorf("removing pr from merge queue failed: %w", err)
}

Expand Down
Loading