Skip to content

fix(dao): use context-aware methods for database operations in MetaDAO - #23074

Merged
chlins merged 1 commit into
goharbor:mainfrom
Serviceware:fix/ctx-meta-dao
Apr 15, 2026
Merged

chlins merged 1 commit into
goharbor:mainfrom
Serviceware:fix/ctx-meta-dao

Conversation

@mxab

@mxab mxab commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Uses the context-aware methods of the ORM so cancel/timeouts can be detected by the underlying ORM provider

Fixes #22653

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@mxab
mxab requested a review from a team as a code owner April 7, 2026 10:07
@codecov

codecov Bot commented Apr 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
âś… Project coverage is 66.02%. Comparing base (8a610a3) to head (8c7f787).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/pkg/oidc/dao/meta.go 60.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #23074   +/-   ##
=======================================
  Coverage   66.02%   66.02%           
=======================================
  Files        1074     1074           
  Lines      116677   116677           
  Branches     2941     2941           
=======================================
+ Hits        77035    77036    +1     
- Misses      35370    35371    +1     
+ Partials     4272     4270    -2     
Flag Coverage Δ
unittests 66.02% <60.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/pkg/oidc/dao/meta.go 45.76% <60.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mxab
mxab force-pushed the fix/ctx-meta-dao branch from 9095a11 to ece01cc Compare April 7, 2026 10:54
@Vad1mo
Vad1mo requested a review from Copilot April 9, 2026 11:50
@Vad1mo Vad1mo added the release-note/update Update or Fix label Apr 9, 2026
@Vad1mo
Vad1mo enabled auto-merge (squash) April 9, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the OIDC MetaDAO implementation to use context-aware Beego ORM methods so request cancellations/timeouts can propagate down to database operations, addressing connection starvation concerns reported in #22653.

Changes:

  • Use RawWithCtx for raw SQL execution in DeleteByUserID and GetByUsername.
  • Use UpdateWithCtx, InsertWithCtx, and AllWithCtx for update/insert/list operations to propagate ctx.

đź’ˇ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chlins chlins left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chlins

chlins commented Apr 14, 2026

Copy link
Copy Markdown
Member

@mxab Please rebase the main branch then I can merge this PR.

Signed-off-by: Max Froehlich <max.froehlich@serviceware.de>
auto-merge was automatically disabled April 14, 2026 13:07

Head branch was pushed to by a user without write access

@mxab
mxab force-pushed the fix/ctx-meta-dao branch from ece01cc to 8c7f787 Compare April 14, 2026 13:07
@mxab

mxab commented Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

done

@chlins
chlins merged commit 1524e93 into goharbor:main Apr 15, 2026
11 of 12 checks passed
bupd pushed a commit to container-registry/8gcr that referenced this pull request May 19, 2026
… in MetaDAO

Upstream-PR: goharbor/harbor#23074

Upstream-Author: @mxab
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
bupd pushed a commit to container-registry/8gcr that referenced this pull request May 19, 2026
… in MetaDAO

Upstream-PR: goharbor/harbor#23074

Upstream-Author: @mxab
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
bupd pushed a commit to container-registry/8gcr that referenced this pull request May 19, 2026
… in MetaDAO

Upstream-PR: goharbor/harbor#23074

Upstream-Author: @mxab
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
bupd pushed a commit to container-registry/8gcr that referenced this pull request Jun 9, 2026
… in MetaDAO

Upstream-PR: goharbor/harbor#23074

Upstream-Author: @mxab
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
(cherry picked from commit cd6ddfe)
Signed-off-by: Prasanth Baskar <bupdprasanth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/update Update or Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetByUsername look does not take ctx into account when reading

6 participants