mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 06:52:54 +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:
parent
c42b71877e
commit
b167f35113
50 changed files with 209 additions and 237 deletions
|
@ -465,8 +465,9 @@ func (comments CommentList) loadReviews(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// loadAttributes loads all attributes
|
||||
func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
|
||||
// LoadAttributes loads attributes of the comments, except for attachments and
|
||||
// comments
|
||||
func (comments CommentList) LoadAttributes(ctx context.Context) (err error) {
|
||||
if err = comments.LoadPosters(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -501,9 +502,3 @@ func (comments CommentList) loadAttributes(ctx context.Context) (err error) {
|
|||
|
||||
return comments.loadDependentIssues(ctx)
|
||||
}
|
||||
|
||||
// LoadAttributes loads attributes of the comments, except for attachments and
|
||||
// comments
|
||||
func (comments CommentList) LoadAttributes() error {
|
||||
return comments.loadAttributes(db.DefaultContext)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue