Module: ActiveJob::Locks::Options

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_job/locks/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lock_typeObject (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_lockObject (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_lockObject (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, options = {})
  @lock_type = lock_type
  @queue_lock = @lock_type == :queue
  @payload_lock = @lock_type == :payload
  @options = options
  @redis = redis
end

#requeue_waitObject



22
23
24
# File 'lib/active_job/locks/options.rb', line 22

def requeue_wait
	@options[:requeue_wait]
end

#ttlObject



18
19
20
# File 'lib/active_job/locks/options.rb', line 18

def ttl
  @options[:ttl] || 1.minute
end