Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync single external service (#13483)
* repo-updater: Sync single external service at a time using workerutil Tests are still failing * repoupdater: Fix server_test * testSyncerSyncWithErrors uses SyncExternalService Also removes a test case that tests a sync of muktiple external services as we no longer support that. * Add EnqueueJobs tests * Removed old references to syncer.Sync Code now compiles but a lot of tests still fail. Added a cleanup function that needs to be called when we stop a worker to unregister prometheus metrics so that it doesn't panic when we start another worker in a subsequent test. * Fix repo-updater tests * Delete orphaned repos * Avoid constraints by changing upsert order * Fix minSyncInterval * WIP test sync * Add a test that syncs multiple external services in sequence * WIP test for orphaned repos * Only delete orphaned repos * repo-updater: Remove stale jobs on startup If a job is processing when repo-updater dies that job would never complete. We would then not requeue the associated external service for syncing. To be safe we delete non locked processing rows on startup. * Typo * db: Mark next_synced_at on service save This will cause a sync to be triggered ASAP for the saved external service. On save, we trigger a call to repo-updater which causes us to enqueue any pending sync jobs. As we've just upated next_sync_at the job for the newly saved repo will be queued. * Rename trigger We no longer trigger a full sync but instead trigger enqueueing pending sync jobs. * Remove orphaned repo code We now have a trigger that does the same thing * Improve orphaned repo test * Test external service deletion * Remove orphaned repo code from syncSubset * Remove leftover debug line * Fix deleting of repos when called via syncSubset * Improve EnqueueSyncJobs docstring Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com> * Improve error message Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com> * Check rows.Err() after iteration * Change log line to debug Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com> * Remove leftover debug line * Add stalled jobs resetter * Pass prometheus register to the SyncWorker * Create ResetterMetrics inline * Remove unused field * Fix docstring * Typo * Missing period * Typo * Add failing test * Resolve name conflicts deterministically * Cleanup name conflicts resolution * Resolve name conflicts during renames * Don't wrap nil error * Don't queue jobs for Phabricator services * Handle large name lists in StoreListReposArgs.Names * Trigger rebuild * Remove stale job cleanup code We use the workerutil resetter now instead * Add failing test * Fix predicate on sourcegraphcom mode * Don't sync deleted external services * When in cloud mode DON'T sync admin added external services Co-authored-by: Asdine El Hrychy <asdine.elhrychy@gmail.com> Co-authored-by: ᴜɴᴋɴᴡᴏɴ <joe@sourcegraph.com>
- Loading branch information
1 parent
9b6e31a
commit d00157a
Showing
15 changed files
with
1,582 additions
and
303 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.