Skip to content

Instantly share code, notes, and snippets.

@sco
Created September 23, 2008 16:56
Show Gist options
  • Save sco/12334 to your computer and use it in GitHub Desktop.
Save sco/12334 to your computer and use it in GitHub Desktop.
require 'timeout'
class RequestTimeout < Merb::Rack::Middleware
def initialize(app, seconds)
super(app)
@seconds = seconds
end
def deferred?(env)
@app.deferred?(env)
end
def call(env)
Timeout::timeout(@seconds) do
@app.call(env)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment