1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00: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
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
}