Class: Sidekiq::Middleware::Server::Timeout

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/middleware/server/timeout.rb

Instance Method Summary collapse

Instance Method Details

#call(worker, msg, queue) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/sidekiq/middleware/server/timeout.rb', line 8

def call(worker, msg, queue)
  if msg['timeout'] && msg['timeout'].to_i != 0
    ::Timeout.timeout(msg['timeout'].to_i) do
      yield
    end
  else
    yield
  end
end