diff --git a/services/pull/check.go b/services/pull/check.go index 736be4611b..baca1511a2 100644 --- a/services/pull/check.go +++ b/services/pull/check.go @@ -301,11 +301,16 @@ func manuallyMerged(ctx context.Context, pr *issues_model.PullRequest) bool { pr.Merger = merger pr.MergerID = merger.ID - if merged, err := pr.SetMerged(ctx); err != nil { + if err := db.WithTx(ctx, func(ctx context.Context) error { + if merged, err := pr.SetMerged(ctx); err != nil { + return err + } else if !merged { + return errors.New("setMerged failed") + } + return nil + }); err != nil { log.Error("%-v setMerged : %v", pr, err) return false - } else if !merged { - return false } notify_service.MergePullRequest(ctx, merger, pr)