External service syncing holds locks for too long
View options
- Truncate descriptions
Created by: ryanslade
Syncing external services happen as part of a transaction because they are triggered by our workerutil
package. The sync operation can take a long time for large numbers of repos since it involves communicating with code hosts.
We should reorder the requests we make so that we don't touch shared tables such as external_service_repos
and repo
from within the transaction until we've finished slow path of making external requests. This will stop our transaction from holding locks on the shared tables for too long.
It is acceptable to keep the lock on the external_service_sync_jobs
table.
Related to: https://github.com/sourcegraph/customer/issues/139

