Skip to content

Update Ci::PendingBuild async when shared runner is toggled

Max Orefice requested to merge mo-update-pending-builds-async into master

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:

Here a screenshot of this new behavior below 👇

rails_c_2021-12-06_11-12-43

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Max Orefice

Merge request reports

Loading