Class: MicroQ::Middleware::Server::Timeout

Inherits:
Object
  • Object
show all
Includes:
Timeout
Defined in:
lib/micro_q/middleware/server/timeout.rb

Constant Summary collapse

DEFAULT =
10 * 60

Instance Method Summary collapse

Instance Method Details

#call(_, message) ⇒ Object



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

def call(_, message)
  time = (time = message['timeout'].to_i) > 0 ? time : DEFAULT

  timeout(time) do
    yield
  end
end