Class: Creeper::Middleware::Server::Timeout

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

Instance Method Summary collapse

Instance Method Details

#call(worker, msg, queue, job, conn) ⇒ Object



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

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