Created by: mollylogue
background task in repo-updater to check for repos w/ nonempty last_error and update
Fixes https://github.com/sourcegraph/sourcegraph/issues/25217
TODOs:
syncer.SyncRepo
, then remove sleep statement from test.Questions:
Syncer
for this task as is used everywhere else? I ask because presumably then all these tasks are publishing to the same Synced
channel and I'm not sure if that's okay or not.NOTE: I'm adding a super rough screen recording of the behavior with this code. You'll see that I see the repo when it's public, then when I turn it to private and navigate back to it on sourcegraph.com, I still see it. When I check the logs I see that gitserver
has run into an error (since it can't find the repo anymore). Then, when I restart to trigger the repo-updater running, now the repo updater finds these gitserver errors in the gitserver_repos
table and updates the repo, causing it to be deleted. When I navigate back to the page, you see that now it displays a 404 Repository Not Found
as desired.
UPDATE: This is now split into two PRs. https://github.com/sourcegraph/sourcegraph/pull/28554 adds in some changes around the repo.Store
code. This PR is based off of that branch for now for ease of review/commenting but should be rebased on main once the other PR is merged.
UPDATE: (12/8/21) I'd like to get https://github.com/sourcegraph/sourcegraph/pull/28655 merged first so that I can rebase and improve the testing of this by removing that asynchronous logic.