Update Ci::PendingBuild async when shared runner is toggled
Ref: #346229 (closed)
What does this MR do and why?
Following up !75197 (merged), this MR fixes a cross database query between our 2 new databases identified as a ~"sharding-blocker" when a group is transferred.
Why are we doing this?
As explained on our multi databases documentation it will not be possible to make a transaction accessing our 2 databases.
This is why need to execute the Groups::UpdateSharedRunnersService
outside of the Group.transaction.
To solve this problem we are leveraging .run_after_commit_or_now to ensure we first persist the group and close the transaction before the ci_pending_builds
table which is will happen in separate database.
Here are the 2 places where our new callback will get triggered when updating the shared_runners
setting for a group:
- UpdateService - happening outside of a transaction
- TransferService - happening in a transaction
Here a screenshot of this new behavior below
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.