1
0
Fork 0
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:
Bo-Yi Wu 2018-02-21 18:55:34 +08:00 committed by GitHub
parent d27d720f05
commit 04b3e8cbdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 118 additions and 34 deletions

View file

@ -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
}