1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-12 04:28:21 +00:00

refactor: reduce sql query in retrieveFeeds (#3554)

This commit is contained in:
Bo-Yi Wu
2018-02-22 00:15:00 +08:00
committed by Lauris BH
parent e8015a59bb
commit ed2ba84525
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
}