Module: Resque::Plugins::Timeout

Defined in:
lib/resque/plugins/timeout.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.switchObject



7
8
9
# File 'lib/resque/plugins/timeout.rb', line 7

def self.switch
  @switch ||= :on
end

.switch=(val) ⇒ Object



11
12
13
# File 'lib/resque/plugins/timeout.rb', line 11

def self.switch=(val)
  @switch = val
end

.timeoutObject



15
16
17
# File 'lib/resque/plugins/timeout.rb', line 15

def self.timeout
  @timeout ||= 600
end

.timeout=(val) ⇒ Object



19
20
21
# File 'lib/resque/plugins/timeout.rb', line 19

def self.timeout=(val)
  @timeout = val
end

Instance Method Details

#around_perform_with_timeout(*args) ⇒ Object



23
24
25
26
27
# File 'lib/resque/plugins/timeout.rb', line 23

def around_perform_with_timeout(*args)
  ::Timeout.timeout(Resque::Plugins::Timeout.timeout) do
    yield
  end
end