Class: Jumbotron::Services::Adapters::ExecuteSynchronizationScope
- Inherits:
-
CommandTower::Services::ApplicationService
- Object
- CommandTower::Services::ApplicationService
- Jumbotron::Services::Adapters::ExecuteSynchronizationScope
- Defined in:
- app/services/jumbotron/services/adapters/execute_synchronization_scope.rb
Overview
Isolates lease + existing SynchronizeAdapterWorkflow.call. The workflow-calls-workflow rule remains deferred; do not invent a SharedSequence here.
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/services/jumbotron/services/adapters/execute_synchronization_scope.rb', line 14 def call lease = Synchronization::Lease.new lease_scope = Synchronization::Lease.scope( adapter_id: adapter.adapter_id, endpoint: endpoint, acquisition: acquisition ) held = lease.acquire(lease_scope) unless held.acquired? context.outcome = :contention return end begin record_sync_outcome( Workflows::SynchronizeAdapterWorkflow.call( adapter: adapter, endpoint: endpoint, league_id: league.id, acquisition: acquisition ) ) ensure lease.release(lease_scope, token: held.token) end end |