RepositoryCheck::ClearWorker is too aggressive

RepositoryCheck::ClearWorker updates all project rows, but it does that way too aggressive. The current implementation caused gitlab-com/gl-infra/production#451 (closed)

Problem

Because all rows were updated, it created a huge replication lag to the other database nodes.

Proposal

Update the rows and batches and wait a bit between each batch.

Maybe we should extract the last_repository_check_failed and last_repository_check_at columns from projects and use another table for those.

Edited by 🤖 GitLab Bot 🤖