mirror of
https://github.com/go-gitea/gitea
synced 2025-07-15 23:17:19 +00:00
Add context parameter to some database functions (#26055)
To avoid deadlock problem, almost database related functions should be have ctx as the first parameter. This PR do a refactor for some of these functions.
This commit is contained in:
@ -222,7 +222,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
commits := repo_module.GitToPushCommits(l)
|
||||
commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)
|
||||
|
||||
if err := issue_service.UpdateIssuesCommit(pusher, repo, commits.Commits, refName); err != nil {
|
||||
if err := issue_service.UpdateIssuesCommit(ctx, pusher, repo, commits.Commits, refName); err != nil {
|
||||
log.Error("updateIssuesCommit: %v", err)
|
||||
}
|
||||
|
||||
@ -269,12 +269,12 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
|
||||
}
|
||||
} else {
|
||||
notification.NotifyDeleteRef(ctx, pusher, repo, opts.RefFullName)
|
||||
if err = pull_service.CloseBranchPulls(pusher, repo.ID, branch); err != nil {
|
||||
if err = pull_service.CloseBranchPulls(ctx, pusher, repo.ID, branch); err != nil {
|
||||
// close all related pulls
|
||||
log.Error("close related pull request failed: %v", err)
|
||||
}
|
||||
|
||||
if err := git_model.AddDeletedBranch(db.DefaultContext, repo.ID, branch, pusher.ID); err != nil {
|
||||
if err := git_model.AddDeletedBranch(ctx, repo.ID, branch, pusher.ID); err != nil {
|
||||
return fmt.Errorf("AddDeletedBranch %s:%s failed: %v", repo.FullName(), branch, err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user