Fix exclusive lease usage in transaction for app/services/ci/retry_job_service.rb
See original issue in #440368 (closed).
Problem
The problem happens because the after_transition hook, runs in the context of a transaction, then, the flow runs in the following order (see here for more):
-
RetryJobServiceis called - Then the
AddJobServiceis called and tries to acquire a lock within the initial transaction which started in theafter_transitionhook.
Implementation Details
- Use the run_after_commit hook described here
Edited by Panos Kanellidis