GitHub importer: Add defer_on_database_health_signal support to avoid DB-related incidents
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
About
Imports can potentially cause, or exasperate, incidents relating to the database due to the high number of writes or reads they perform.
Sidekiq workers can be deferred if the database tables they use are unhealthy. We implemented this for Importer:Direct Transfer in !136137 (merged).
Proposal
In the case of GitHub, we probably only need to consider our writes (I think these workers are the ones that include ObjectImporter
) to have the potential to be problematic and apply defer_on_database_health_signal
to them.
The workers could define which tables they write to, and ObjectImporter
could hook that up to defer_on_database_health_signal
.
Ideally, this should be implemented change behind a feature flag so we can start working on the task even before #433196 (closed) is completed. We will need to wait for #433196 (closed) to be finished before we can enable the feature flag.