mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-07 20:59:29 +02:00
Use db.WithTx/WithTx2 instead of TxContext when possible (#35130)
This commit is contained in:
1 parent
f201dde945
commit
65cd3f5309
56 files changed
+1999
-2640
No files matched your search
@@ -224,21 +224,9 @@ func CreateReaction(ctx context.Context, opts *ReactionOptions) (*Reaction, erro
|
||||
return nil, ErrForbiddenIssueReaction{opts.Type}
|
||||
}
|
||||
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer committer.Close()
|
||||
|
||||
reaction, err := createReaction(ctx, opts)
|
||||
if err != nil {
|
||||
return reaction, err
|
||||
}
|
||||
|
||||
if err := committer.Commit(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return reaction, nil
|
||||
return db.WithTx2(ctx, func(ctx context.Context) (*Reaction, error) {
|
||||
return createReaction(ctx, opts)
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteReaction deletes reaction for issue or comment.
|
||||
|
||||
Reference in new issue
Block a user