mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 00:45:22 +02:00
refactor: reduce sql query in retrieveFeeds (#3547)
This commit is contained in:
parent
d27d720f05
commit
04b3e8cbdc
3 changed files with 118 additions and 34 deletions
|
@ -742,5 +742,14 @@ func GetFeeds(opts GetFeedsOptions) ([]*Action, error) {
|
|||
}
|
||||
|
||||
actions := make([]*Action, 0, 20)
|
||||
return actions, x.Limit(20).Desc("id").Where(cond).Find(&actions)
|
||||
|
||||
if err := x.Limit(20).Desc("id").Where(cond).Find(&actions); err != nil {
|
||||
return nil, fmt.Errorf("Find: %v", err)
|
||||
}
|
||||
|
||||
if err := ActionList(actions).LoadAttributes(); err != nil {
|
||||
return nil, fmt.Errorf("LoadAttributes: %v", err)
|
||||
}
|
||||
|
||||
return actions, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue