-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Remove the parallelizing when loading repo for dashboard #24705
Conversation
a1d4b82
to
fc539ef
Compare
repoIDsToLatestCommitSHAs := make(map[int64]string) | ||
wg := sync.WaitGroup{} | ||
wg.Add(len(repos)) | ||
// at most there are dozens of repos (limited by MaxResponseItems), so it's not a big problem at the moment |
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.
(which is limited by RepoPagingNum)
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.
Are you sure?
The PageSize comes from PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
, and ToCorrectPageSize
says:
else if size > setting.API.MaxResponseItems {
size = setting.API.MaxResponseItems
}
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 see, limit is RepoPagingNum but this condition overrides it
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.
Luckily it's checked, that's what I have double-checked.
Otherwise, attackers could to "limit=99999" to DoS the server.
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.
It's fine if you want it serialized, there is such a small number of calls it doesn't matter you are right, the previous code was unsafe
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.
Skip errors, don't include them
Co-authored-by: Yarden Shoham <[email protected]>
Sorry for that, I assumed map was safe |
Co-authored-by: Yarden Shoham <[email protected]>
* upstream/main: (30 commits) Don't filter action runs based on state (go-gitea#24711) Add Go package registry (go-gitea#24687) Fix flash of unstyled content in action view page (go-gitea#24712) Clean up various avatar dimensions (go-gitea#24701) Remove the parallelizing when loading repo for dashboard (go-gitea#24705) Optimize actions list by removing an unnecessary `git` call (go-gitea#24710) Update cron-translations.yml (go-gitea#24708) Fix run list broken when trigger user deleted (go-gitea#24706) Remove Fomantic comment module (go-gitea#24703) Update to Alpine 3.18 (go-gitea#24700) fix minio storage iterator path (go-gitea#24691) Add status indicator on main home screen for each repo (go-gitea#24638) Add test for api team orgnization (go-gitea#24699) Improve button-ghost, remove tertiary button (go-gitea#24692) Add icon support for safari (go-gitea#24697) Improve avatar uploading / resizing / compressing, remove Fomantic card module (go-gitea#24653) Fix docs documenting invalid `@every` for `OLDER_THAN` cron settings (go-gitea#24695) Fix `organization` field being `null` in `GET /api/v1/teams/{id}` (go-gitea#24694) Use standard HTTP library to serve files (go-gitea#24693) Add `eslint-plugin-eslint-comments` (go-gitea#24690) ...
Ref: #24638
IMO, parallelizing might run out server resources more quickly. Gitea shouldn't use a lot of go-routine in a web handler.
And add a comment about how many repositories there could be at most.