Class: Resque::Scheduler::Lock::Resilient
- Inherits:
-
Base
- Object
- Base
- Resque::Scheduler::Lock::Resilient
show all
- Defined in:
- lib/resque/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
Instance Method Details
#acquire! ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/resque/scheduler/lock/resilient.rb', line 8
def acquire!
Resque.redis.evalsha(
acquire_sha,
keys: [key],
argv: [value]
).to_i == 1
end
|
#locked? ⇒ Boolean
16
17
18
19
20
21
22
|
# File 'lib/resque/scheduler/lock/resilient.rb', line 16
def locked?
Resque.redis.evalsha(
locked_sha,
keys: [key],
argv: [value]
).to_i == 1
end
|
#timeout=(seconds) ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/resque/scheduler/lock/resilient.rb', line 24
def timeout=(seconds)
if locked?
@timeout = seconds
@locked_sha = nil
@acquire_sha = nil
end
@timeout
end
|