"Shared runners enabled" setting is not updated on individual builds on subgroups and projects

A follow-up from Re-enable shared runners on descendants (!124728 - merged), but the bug existed before.

UpdateSharedRunnersService updates the instance_runners_enabled on builds that directly belong to the group, but it completely ignores descendants.

So the existing Ci builds may still be executed on shared runners(or not, if you enable the setting after it is disabled)

Workaround

Restart the build after changing the setting

Implementation plan

  1. Move update_pending_builds_async to the background worker because looking up and updating all builds on the group can degrade performance
  2. Execute ::Ci::UpdatePendingBuildService for all subgroups.
Edited by Pedro Pombeiro