Skip to content

fix(issues): fix label bulk-load key and reduce log noise in LoadLabel - #38632

Merged
bircni merged 3 commits into
go-gitea:mainfrom
eliroca:fix-comment-load-label
Jul 26, 2026
Merged

fix(issues): fix label bulk-load key and reduce log noise in LoadLabel#38632
bircni merged 3 commits into
go-gitea:mainfrom
eliroca:fix-comment-load-label

Conversation

@eliroca

@eliroca eliroca commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

CommentList.loadLabels keyed the result map by label.ID but looked up by comment.ID, so every label event fell back to individual DB queries.

This caused log spam for any comment where the label was deleted, since ToTimelineComment calls LoadLabel unconditionally for all comment types including those with LabelID=0.

Fix the map key, skip the query when LabelID=0, demote the now rarely triggered orphaned-label log to Debug, and fix a typo ("Commit" -> "Comment") in that message.

CommentList.loadLabels keyed the result map by label.ID but looked up
by comment.ID, so every label event fell back to individual DB queries.
This caused log spam for any comment where the label was deleted, since
ToTimelineComment calls LoadLabel unconditionally for all comment types
including those with LabelID=0. Fix the map key, skip the query when
LabelID=0, demote the now rarely triggered orphaned-label log to Debug,
and fix a typo ("Commit" -> "Comment") in that message.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 25, 2026
@eliroca
eliroca marked this pull request as draft July 25, 2026 21:03
@eliroca eliroca changed the title WIP: fix(issues): fix label bulk-load key and reduce log noise in LoadLabel fix(issues): fix label bulk-load key and reduce log noise in LoadLabel Jul 25, 2026
@eliroca
eliroca marked this pull request as ready for review July 25, 2026 21:35
Comment thread models/issues/comment_list.go Outdated
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 26, 2026
@lunny lunny added the backport/v1.27 This PR should be backported to Gitea 1.27 label Jul 26, 2026
Comment thread models/issues/comment_list.go Outdated
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 26, 2026
@bircni
bircni enabled auto-merge (squash) July 26, 2026 11:50
@bircni bircni mentioned this pull request Jul 26, 2026
22 tasks
@bircni
bircni merged commit 47565ae into go-gitea:main Jul 26, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 28.0.0 milestone Jul 26, 2026
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Jul 26, 2026
silverwind pushed a commit that referenced this pull request Jul 26, 2026
#38632) (#38643)

Backport #38632 by @eliroca

CommentList.loadLabels keyed the result map by label.ID but looked up by
comment.ID, so every label event fell back to individual DB queries.

This caused log spam for any comment where the label was deleted, since
ToTimelineComment calls LoadLabel unconditionally for all comment types
including those with LabelID=0.

Fix the map key, skip the query when LabelID=0, demote the now rarely
triggered orphaned-label log to Debug, and fix a typo ("Commit" ->
"Comment") in that message.

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Elisei Roca <eroca@suse.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 27, 2026
* 'main' of https://github.com/go-gitea/gitea: (55 commits)
  fix(actions): use base branch ref for pull_request_target context (go-gitea#38636)
  fix(actions): skip already-approved runs in `ApproveRuns` (go-gitea#38653)
  fix(api): accept fully-qualified refs in contents API (go-gitea#38650)
  [skip ci] Updated translations via Crowdin
  chore(build): upload release to Cloudflare R2 (go-gitea#38635)
  ci: match `# renovate:` markers that trail the value (go-gitea#38640)
  feat: admin impersonates a user (go-gitea#38614)
  refactor: git patch apply (go-gitea#38637)
  fix: orgmode render include path (go-gitea#38642)
  fix(actions): cancel tasks immediately when the runner stopped reporting (go-gitea#38616)
  fix(issues): fix label bulk-load key and reduce log noise in LoadLabel (go-gitea#38632)
  fix(ui): avoid layout shifts in `overflow-menu` and repo filter (go-gitea#37818)
  chore: generate codemirror languages from `linguist-languages` package (go-gitea#38624)
  [skip ci] Updated translations via Crowdin
  fix(actions): improve runner list status sorting, labels and task job links (go-gitea#38586)
  fix(actions): correctness and hardening fixes (go-gitea#38518)
  chore: remove goreportcard badge (go-gitea#38630)
  fix(repo): prevent double-write redirect collisions on dependency errors, fix ui (go-gitea#38627)
  fix(deps): update module github.com/getkin/kin-openapi to v0.144.0 [security] (go-gitea#38623)
  chore: update and relax revive naming rules (go-gitea#38615)
  ...
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 27, 2026
* main: (55 commits)
  fix(actions): use base branch ref for pull_request_target context (go-gitea#38636)
  fix(actions): skip already-approved runs in `ApproveRuns` (go-gitea#38653)
  fix(api): accept fully-qualified refs in contents API (go-gitea#38650)
  [skip ci] Updated translations via Crowdin
  chore(build): upload release to Cloudflare R2 (go-gitea#38635)
  ci: match `# renovate:` markers that trail the value (go-gitea#38640)
  feat: admin impersonates a user (go-gitea#38614)
  refactor: git patch apply (go-gitea#38637)
  fix: orgmode render include path (go-gitea#38642)
  fix(actions): cancel tasks immediately when the runner stopped reporting (go-gitea#38616)
  fix(issues): fix label bulk-load key and reduce log noise in LoadLabel (go-gitea#38632)
  fix(ui): avoid layout shifts in `overflow-menu` and repo filter (go-gitea#37818)
  chore: generate codemirror languages from `linguist-languages` package (go-gitea#38624)
  [skip ci] Updated translations via Crowdin
  fix(actions): improve runner list status sorting, labels and task job links (go-gitea#38586)
  fix(actions): correctness and hardening fixes (go-gitea#38518)
  chore: remove goreportcard badge (go-gitea#38630)
  fix(repo): prevent double-write redirect collisions on dependency errors, fix ui (go-gitea#38627)
  fix(deps): update module github.com/getkin/kin-openapi to v0.144.0 [security] (go-gitea#38623)
  chore: update and relax revive naming rules (go-gitea#38615)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/done All backports for this PR have been created backport/v1.27 This PR should be backported to Gitea 1.27 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/issues type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants