Module: Sqeduler::Worker::Synchronization
- Defined in:
- lib/sqeduler/worker/synchronization.rb
Overview
Module that provides common synchronization infrastructure
of workers across multiple hosts Sqeduler::BaseWorker.synchronize_jobs
.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#perform(*args) ⇒ Object
rubocop:enable Style/Documentation.
Class Method Details
.prepended(base) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sqeduler/worker/synchronization.rb', line 10 def self.prepended(base) if base.ancestors.include?(Sqeduler::Worker::Callbacks) fail "Sqeduler::Worker::Callbacks must be the last module that you prepend." end base.extend(ClassMethods) base.class_attribute :synchronize_jobs_mode base.class_attribute :synchronize_jobs_expiration base.class_attribute :synchronize_jobs_timeout end |
Instance Method Details
#perform(*args) ⇒ Object
rubocop:enable Style/Documentation
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/sqeduler/worker/synchronization.rb', line 41 def perform(*args) if self.class.synchronize_jobs_mode == :one_at_a_time perform_locked(self.class.sync_lock_key(*args)) do perform_timed do super end end else super end end |