Class: Ci::ProcessSyncEventsService
- Inherits:
-
Object
- Object
- Ci::ProcessSyncEventsService
- Includes:
- ExclusiveLeaseGuard
- Defined in:
- app/services/ci/process_sync_events_service.rb
Constant Summary collapse
- BATCH_SIZE =
1000
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(sync_event_class, sync_class) ⇒ ProcessSyncEventsService
constructor
A new instance of ProcessSyncEventsService.
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Constructor Details
#initialize(sync_event_class, sync_class) ⇒ ProcessSyncEventsService
Returns a new instance of ProcessSyncEventsService.
9 10 11 12 13 |
# File 'app/services/ci/process_sync_events_service.rb', line 9 def initialize(sync_event_class, sync_class) @sync_event_class = sync_event_class @sync_class = sync_class @results = {} end |
Instance Method Details
#execute ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/services/ci/process_sync_events_service.rb', line 15 def execute # To prevent parallel processing over the same event table try_obtain_lease { process_events } enqueue_worker_if_there_still_event @results end |