Skip to content

repo-updater: Use rate limiter when syncing changesets

Administrator requested to merge syncer-ratelimit-registry into master

Created by: ryanslade

I decided to do the rate limiting in the syncer itself, not in the source. The reason for this is that if we add a rate limiter in the source we need to remember to implement it every time we add a new source and also won't know which operation actually need to be rate limited.

For now, we specifically just need to rate limit syncs that happen as part of background syncing.

The syncer doesn't know the "cost" of a sync though, so I added a new LoadChangesetCost method to ChangesetSource. Although it expands the interface, I think it clearly describes the minimum that a Source needs to implement in order to support changeset syncing.

I also moved some of the sync methods out into functions so that we don't need to have a bunch of short lived syncers that are only used once.

Merge request reports

Loading