Abort requests that are taking too long; a subclass of Rack::Timeout::Error is raised.
A generous timeout of 15s is the default. It's recommended to set the timeout as low as realistically viable for your application.
Usage
| class Wallhugger < RTanque::Bot::Brain | |
| NAME = 'wallhugger' | |
| include RTanque::Bot::BrainHelper | |
| TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 1.0 | |
| def tick! | |
| wallflower | |
| if (target = self.nearest_target) | |
| self.fire_upon(target) |
| def method_missing(meth, *args, &block) | |
| if meth.to_s ~= /^([a-z]+)_v(\d)_json$/ | |
| # add version to args | |
| args << $2 | |
| self.send("#{$1}_json", args) | |
| else | |
| super | |
| end | |
| end |
| class Tester | |
| def foo | |
| bar | |
| end | |
| def bar | |
| baz | |
| end | |
| def baz |
| require 'spec_helper' | |
| require 'middleware_helper' | |
| class RackTimeoutStatus < StandardError; end | |
| describe Rack::Timeout do | |
| include MiddlewareHelper | |
| before :each do | |
| # shut up the logger |
| require 'spec_helper' | |
| if defined?(Rails) && Rails::VERSION::MAJOR == 3 | |
| include Rails3Generator | |
| RACK_TIMEOUT_TIME = 2 | |
| describe "Rails 3 Integration", type: :feature do | |
| before :all do | |
| create_app | |
| add_rack_timeout(RACK_TIMEOUT_TIME) | |
| set_log_level(:debug) |
| Process: WebKitPluginHost [60933] | |
| Path: /System/Library/Frameworks/WebKit.framework/WebKitPluginHost.app/Contents/MacOS/WebKitPluginHost | |
| Identifier: com.apple.WebKit.PluginHost | |
| Version: 9537 (9537.75.12) | |
| Build Info: WebKitPluginHost-7537075012000000~5 | |
| Code Type: X86-64 (Native) | |
| Parent Process: WebKitPluginAgent [59253] | |
| Responsible: WebKitPluginAgent [59253] | |
| User ID: 502 |
| --- Here's me making a POST request to the app: | |
| ¤äøb#x20lLPOST /productbuilderrest/uploadpdf/12345/ HTTP/1.1 | |
| Host: testing.wentzel.nl | |
| Connection: close | |
| User-Agent: curl/7.30.0 | |
| Cookie: sessionid=ghqycg7idnej3r3kcipudwqelmanzq6l | |
| Accept: application/json | |
| X-Http-Method-Override: PATCH | |
| Content-Type: application/json | |
| X-Request-Id: 73f9c9c9-d8f1-4c82-bd26-4e48737d4d36 |
Make me an offer on any of this stuff, no matter how crazy you think it might be. If it saves me having to eBay it, I'll probably take it. @chadbailey59 or chad bailey at gmail.
| ### Keybase proof | |
| I hereby claim: | |
| * I am chadbailey59 on github. | |
| * I am chadbailey59 (https://keybase.io/chadbailey59) on keybase. | |
| * I have a public key whose fingerprint is 9CF1 C29A 3C30 4E94 FBAA DBB3 5ADC 08B8 B703 7D8B | |
| To claim this, I am signing this object: |