loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[gitea] week 2025-11 cherry pick (gitea/main -> forgejo) (#7176)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7176
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>

Gusted 168b0ea9 a479fef4

+22 -7
+3 -6
models/actions/schedule.go
··· 45 45 // GetSchedulesMapByIDs returns the schedules by given id slice. 46 46 func GetSchedulesMapByIDs(ctx context.Context, ids []int64) (map[int64]*ActionSchedule, error) { 47 47 schedules := make(map[int64]*ActionSchedule, len(ids)) 48 + if len(ids) == 0 { 49 + return schedules, nil 50 + } 48 51 return schedules, db.GetEngine(ctx).In("id", ids).Find(&schedules) 49 - } 50 - 51 - // GetReposMapByIDs returns the repos by given id slice. 52 - func GetReposMapByIDs(ctx context.Context, ids []int64) (map[int64]*repo_model.Repository, error) { 53 - repos := make(map[int64]*repo_model.Repository, len(ids)) 54 - return repos, db.GetEngine(ctx).In("id", ids).Find(&repos) 55 52 } 56 53 57 54 // CreateScheduleTask creates new schedule task.
+1 -1
models/actions/schedule_spec_list.go
··· 36 36 } 37 37 38 38 repoIDs := specs.GetRepoIDs() 39 - repos, err := GetReposMapByIDs(ctx, repoIDs) 39 + repos, err := repo_model.GetRepositoriesMapByIDs(ctx, repoIDs) 40 40 if err != nil { 41 41 return err 42 42 }
+3
models/db/context.go
··· 269 269 // DecrByIDs decreases the given column for entities of the "bean" type with one of the given ids by one 270 270 // Timestamps of the entities won't be updated 271 271 func DecrByIDs(ctx context.Context, ids []int64, decrCol string, bean any) error { 272 + if len(ids) == 0 { 273 + return nil 274 + } 272 275 _, err := GetEngine(ctx).Decr(decrCol).In("id", ids).NoAutoCondition().NoAutoTime().Update(bean) 273 276 return err 274 277 }
+3
models/issues/issue.go
··· 546 546 // If keepOrder is true, the order of the returned issues will be the same as the given IDs. 547 547 func GetIssuesByIDs(ctx context.Context, issueIDs []int64, keepOrder ...bool) (IssueList, error) { 548 548 issues := make([]*Issue, 0, len(issueIDs)) 549 + if len(issueIDs) == 0 { 550 + return issues, nil 551 + } 549 552 550 553 if err := db.GetEngine(ctx).In("id", issueIDs).Find(&issues); err != nil { 551 554 return nil, err
+9
models/issues/label.go
··· 303 303 // GetLabelsByIDs returns a list of labels by IDs 304 304 func GetLabelsByIDs(ctx context.Context, labelIDs []int64, cols ...string) ([]*Label, error) { 305 305 labels := make([]*Label, 0, len(labelIDs)) 306 + if len(labelIDs) == 0 { 307 + return labels, nil 308 + } 306 309 return labels, db.GetEngine(ctx).Table("label"). 307 310 In("id", labelIDs). 308 311 Asc("name"). ··· 379 382 // it silently ignores label IDs that do not belong to the repository. 380 383 func GetLabelsInRepoByIDs(ctx context.Context, repoID int64, labelIDs []int64) ([]*Label, error) { 381 384 labels := make([]*Label, 0, len(labelIDs)) 385 + if len(labelIDs) == 0 { 386 + return labels, nil 387 + } 382 388 return labels, db.GetEngine(ctx). 383 389 Where("repo_id = ?", repoID). 384 390 In("id", labelIDs). ··· 451 457 // it silently ignores label IDs that do not belong to the organization. 452 458 func GetLabelsInOrgByIDs(ctx context.Context, orgID int64, labelIDs []int64) ([]*Label, error) { 453 459 labels := make([]*Label, 0, len(labelIDs)) 460 + if len(labelIDs) == 0 { 461 + return labels, nil 462 + } 454 463 return labels, db.GetEngine(ctx). 455 464 Where("org_id = ?", orgID). 456 465 In("id", labelIDs).
+3
models/project/column.go
··· 293 293 294 294 func GetColumnsByIDs(ctx context.Context, projectID int64, columnsIDs []int64) (ColumnList, error) { 295 295 columns := make([]*Column, 0, 5) 296 + if len(columnsIDs) == 0 { 297 + return columns, nil 298 + } 296 299 if err := db.GetEngine(ctx). 297 300 Where("project_id =?", projectID). 298 301 In("id", columnsIDs).