-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: listAuthorizedProjectIDs should not get metadata #21555
base: main
Are you sure you want to change the base?
Conversation
… Metadata Signed-off-by: 曹阳兴 <[email protected]>
@@ -153,7 +153,7 @@ func (r *repositoryAPI) listAuthorizedProjectIDs(ctx context.Context) ([]int64, | |||
query.Keywords["public"] = true | |||
} | |||
|
|||
projects, err := r.proCtl.List(ctx, query) | |||
projects, err := r.proCtl.List(ctx, query, project.Detail(false)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can also set the WithMetadata to false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think project.Detail(false)
has set WithMetadata to false. But the explicit assignment is also OK
harbor/src/controller/project/controller.go
Line 254 in 490f898
func (c *controller) assembleProjects(ctx context.Context, projects models.Projects, options ...Option) error { |
@Czoyx Thanks for catching that, could you also provide the performance comparison for reference? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #21555 +/- ##
==========================================
+ Coverage 45.36% 46.26% +0.89%
==========================================
Files 244 247 +3
Lines 13333 13883 +550
Branches 2719 2875 +156
==========================================
+ Hits 6049 6423 +374
- Misses 6983 7122 +139
- Partials 301 338 +37
Flags with carried forward coverage won't be shown. Click here to find out more. |
The
ListRepositories
interface was taking excessively long to execute. The root cause was thatlistAuthorizedProjectIDs
was fetching unnecessary metadata. This PR removes the metadata retrieval from listAuthorizedProjectIDs, thereby improving the overall performance of the interface.Comprehensive Summary of your change
Issue being fixed
Fixes #(issue)
Please indicate you've done the following: