Module: ResqueAdmin::Scheduler::Locking

Included in:
ResqueAdmin::Scheduler
Defined in:
lib/resque/scheduler/locking.rb,
lib/resque/scheduler_admin/locking.rb,
lib/resque_admin/scheduler/locking.rb

Instance Method Summary collapse

Instance Method Details

#master?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/resque/scheduler/locking.rb', line 65

def master?
  master_lock.acquire! || master_lock.locked?
end

#master_lockObject



57
58
59
# File 'lib/resque/scheduler/locking.rb', line 57

def master_lock
  @master_lock ||= build_master_lock
end

#release_master_lockObject



77
78
79
80
81
# File 'lib/resque/scheduler/locking.rb', line 77

def release_master_lock
  master_lock.release
rescue Errno::EAGAIN, Errno::ECONNRESET, Redis::CannotConnectError
  @master_lock = nil
end

#release_master_lock!Object



69
70
71
72
73
74
75
# File 'lib/resque/scheduler/locking.rb', line 69

def release_master_lock!
  warn "#{self}\#release_master_lock! is deprecated because it does " \
       "not respect lock ownership. Use #{self}\#release_master_lock " \
       "instead (at #{caller.first}"

  master_lock.release!
end

#supports_lua?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/resque/scheduler/locking.rb', line 61

def supports_lua?
  redis_master_version >= 2.5
end