This repository was archived by the owner on Sep 30, 2024. It is now read-only.
repo-updater: Hydrate schedule on startup#62891
Merged
Merged
Conversation
Member
Author
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
eseliger
commented
Jun 3, 2024
| if len(managed) == 0 { | ||
| return nil | ||
| } |
Member
Author
There was a problem hiding this comment.
fixes an edge-case where the schedule is empty and all repos would be loaded into the scheduler accidentally.
eseliger
commented
Jun 3, 2024
| ctx, cancel := context.WithCancel(actor.WithInternalActor(context.Background())) | ||
| s.cancelCtx = cancel | ||
|
|
||
| if !dotcom.SourcegraphDotComMode() { |
Member
Author
There was a problem hiding this comment.
This cannot work as easily for dotcom, it's too complex right now with the indexed repos and friends are indexed and fetched regularly only stuff.
I didn't want to spend too many brain cycles on this, but we can get back to it.
3689395 to
971d93a
Compare
Currently, when repo-updater restarts it loses all intel it collected over time. That causes a large flood of git fetch requests after it restarts. Every repo will be enqueued for an immediate update. This PR fixes that by populating the scheduler with an initial delay per repo that is calculated with the same heuristic that the scheduler uses when it's fully warmed up. This should avoid fetching git repos that are very stale (most likely the majority on instances with many repos). Test plan: Ran it locally, verified the scheduler state using the instrumentation tool for it, the schedule looks as expected and most repos aren't scheduled for the next 8h.
971d93a to
1a0ebd7
Compare
mmanela
approved these changes
Jun 4, 2024
eseliger
referenced
this pull request
Jun 4, 2024
My local instance has few repos enough that this doesn't happen, but on larger instances this preloading fights with the new preloading. They are both best effort, and are meant to achieve the same thing. Thus, this one is not required anymore, and we can delete it, after we added another one in https://github.com/sourcegraph/sourcegraph/pull/62891. Test plan: Verified with sleeps and logs locally that repos are correctly upserted in the schedule now.
eseliger
referenced
this pull request
Jun 4, 2024
…#63086) My local instance has few repos enough that this doesn't happen, but on larger instances this preloading fights with the new preloading. They are both best effort, and are meant to achieve the same thing. Thus, this one is not required anymore, and we can delete it, after we added another one in https://github.com/sourcegraph/sourcegraph/pull/62891. Test plan: Verified with sleeps and logs locally that repos are correctly upserted in the schedule now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Currently, when repo-updater restarts it loses all intel it collected over time. That causes a large flood of git fetch requests after it restarts. Every repo will be enqueued for an immediate update.
This PR fixes that by populating the scheduler with an initial delay per repo that is calculated with the same heuristic that the scheduler uses when it's fully warmed up.
This should avoid fetching git repos that are very stale (most likely the majority on instances with many repos).
Test plan:
Ran it locally, verified the scheduler state using the instrumentation tool for it, the schedule looks as expected and most repos aren't scheduled for the next 8h.