Class: ResqueAdmin::Scheduler::Lock::Resilient

Inherits:
Base
  • Object
show all
Defined in:
lib/resque_admin/scheduler/lock/resilient.rb

Instance Attribute Summary

Attributes inherited from Base

#key, #timeout

Instance Method Summary collapse

Methods inherited from Base

#initialize, #release, #release!, #value

Constructor Details

This class inherits a constructor from ResqueAdmin::Scheduler::Lock::Base

Instance Method Details

#acquire!Object



8
9
10
# File 'lib/resque_admin/scheduler/lock/resilient.rb', line 8

def acquire!
  evalsha(:acquire, [key], [value]).to_i == 1
end

#locked?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/resque_admin/scheduler/lock/resilient.rb', line 12

def locked?
  evalsha(:locked, [key], [value]).to_i == 1
end

#timeout=(seconds) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/resque_admin/scheduler/lock/resilient.rb', line 16

def timeout=(seconds)
  if locked?
    @timeout = seconds
    @locked_sha = nil
    @acquire_sha = nil
  end
  @timeout
end