@@ -208,10 +208,7 @@ func (nl NotificationList) LoadRepos(ctx context.Context) (repo_model.Repository
208208 repos := make (map [int64 ]* repo_model.Repository , len (repoIDs ))
209209 left := len (repoIDs )
210210 for left > 0 {
211- limit := db .DefaultMaxInSize
212- if left < limit {
213- limit = left
214- }
211+ limit := min (left , db .DefaultMaxInSize )
215212 rows , err := db .GetEngine (ctx ).
216213 In ("id" , repoIDs [:limit ]).
217214 Rows (new (repo_model.Repository ))
@@ -282,10 +279,7 @@ func (nl NotificationList) LoadIssues(ctx context.Context) ([]int, error) {
282279 issues := make (map [int64 ]* issues_model.Issue , len (issueIDs ))
283280 left := len (issueIDs )
284281 for left > 0 {
285- limit := db .DefaultMaxInSize
286- if left < limit {
287- limit = left
288- }
282+ limit := min (left , db .DefaultMaxInSize )
289283 rows , err := db .GetEngine (ctx ).
290284 In ("id" , issueIDs [:limit ]).
291285 Rows (new (issues_model.Issue ))
@@ -377,10 +371,7 @@ func (nl NotificationList) LoadUsers(ctx context.Context) ([]int, error) {
377371 users := make (map [int64 ]* user_model.User , len (userIDs ))
378372 left := len (userIDs )
379373 for left > 0 {
380- limit := db .DefaultMaxInSize
381- if left < limit {
382- limit = left
383- }
374+ limit := min (left , db .DefaultMaxInSize )
384375 rows , err := db .GetEngine (ctx ).
385376 In ("id" , userIDs [:limit ]).
386377 Rows (new (user_model.User ))
@@ -428,10 +419,7 @@ func (nl NotificationList) LoadComments(ctx context.Context) ([]int, error) {
428419 comments := make (map [int64 ]* issues_model.Comment , len (commentIDs ))
429420 left := len (commentIDs )
430421 for left > 0 {
431- limit := db .DefaultMaxInSize
432- if left < limit {
433- limit = left
434- }
422+ limit := min (left , db .DefaultMaxInSize )
435423 rows , err := db .GetEngine (ctx ).
436424 In ("id" , commentIDs [:limit ]).
437425 Rows (new (issues_model.Comment ))
0 commit comments