Module: ActiveJob::Locks::Options
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_job/locks/options.rb
Instance Attribute Summary collapse
-
#lock_type ⇒ Object
readonly
Returns the value of attribute lock_type.
-
#payload_lock ⇒ Object
readonly
Returns the value of attribute payload_lock.
-
#queue_lock ⇒ Object
readonly
Returns the value of attribute queue_lock.
Instance Method Summary collapse
Instance Attribute Details
#lock_type ⇒ Object (readonly)
Returns the value of attribute lock_type.
6 7 8 |
# File 'lib/active_job/locks/options.rb', line 6 def lock_type @lock_type end |
#payload_lock ⇒ Object (readonly)
Returns the value of attribute payload_lock.
8 9 10 |
# File 'lib/active_job/locks/options.rb', line 8 def payload_lock @payload_lock end |
#queue_lock ⇒ Object (readonly)
Returns the value of attribute queue_lock.
7 8 9 |
# File 'lib/active_job/locks/options.rb', line 7 def queue_lock @queue_lock end |
Instance Method Details
#lock_by(lock_type, options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/active_job/locks/options.rb', line 10 def lock_by(lock_type, = {}) @lock_type = lock_type @queue_lock = @lock_type == :queue @payload_lock = @lock_type == :payload @options = @redis = redis end |
#requeue_wait ⇒ Object
22 23 24 |
# File 'lib/active_job/locks/options.rb', line 22 def requeue_wait @options[:requeue_wait] end |
#ttl ⇒ Object
18 19 20 |
# File 'lib/active_job/locks/options.rb', line 18 def ttl @options[:ttl] || 1.minute end |