Add slight delay between insert/delete batches during project authorizations refresh
What does this MR do and why?
MR for the issue: https://gitlab.com/gitlab-org/gitlab/-/issues/363163
The requirement in the issue is to add a slight delay when we insert or delete multiple batches of project_authorizations
records.
This delay will help the replica database to catch up with the primary database in the event where multiple batches of such records are being/inserted deleted.
If we give the replica enough time to catch up with the primary this way, they'll remain in sync and further reads to replica's can happen properly without being diverted to primary due to replication lag.
We have already made changes previously across multiple MRs such that all project authorizations refresh jobs happen only from within Sidekiq, and not in Puma threads. See: !90495 (merged), !93352 (merged), !91572 (merged), !92515 (merged) and !96650 (merged)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.