Something went wrong on our end. Please try again.
Created by: mrnugget
(Previous, non-enterprise PR: https://github.com/sourcegraph/sourcegraph/pull/5648)
This PR moves the syncing part of the CreateChangesets
resolver method to a repos.ChangesetSyncer
with a Sync
method.
This Sync
method is then called in the resolver itself and in the background, in the original Syncer
.
The reason we're calling it in the Syncer
is that we don't want to have another, separate loop that would send requests to GitHub, possibly triggering their API abuse detection mechanism.
The ChangesetSyncer.Sync
method is integration tested through the GraphQL tests for CreateChangesets
, which call the same method. That it's periodically called in the background I tested manually with multiple changesets.
Do we need a feature flag? Not sure. Right now the changeset syncer does nothing if there are no changesets in the database.
What's missing? Depends on the level of polish we're going for. Some ideas:
ChangesetSyncer
on every run. If there are no changesets in the database (99% of our customers), then it does nothing. I'm not sure whether we need a flag in addition to that.repos.Store
from the Syncer instead of constructing its own in the Sync
methodRun
method this new syncer calls both syncers Sync
method.ChangesetSyncer