rack-timeout 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +112 -0
- data/README.md +117 -0
- data/UPGRADING.md +19 -0
- data/lib/rack-timeout.rb +1 -1
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a13210b3a4119f8fb5d6c4bc6f6c48ab24fbddcd
|
4
|
+
data.tar.gz: 37718bb72a7a86a3c5e525e37546bf84891100df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ed18160165e8511b56d7627dcc82f129162c4dbaeacaaea3b25cef1b66ec72b601a33bf9413b39bd24c434972278f3dd54b508d7452a3fa934607c034c33a1c
|
7
|
+
data.tar.gz: 4c9bf93aefac52b1523a6619b8ff0b9b2e0ee8dd7a7cc818df3ebc6c8ca80354e11e5119cb75ee172922abdef3d7784afe9090ec52521fbf333cd86020479f38
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
0.5.2
|
2
|
+
=====
|
3
|
+
- Rails 6 support (#147)
|
4
|
+
|
5
|
+
0.5.1
|
6
|
+
=====
|
7
|
+
- Fixes setting ENV vars to false or 0 would not disable a timeout
|
8
|
+
(#133)
|
9
|
+
|
10
|
+
0.5.0.1
|
11
|
+
=======
|
12
|
+
- Fix 0600 permissions in gem pushed to rubygems
|
13
|
+
|
14
|
+
0.5.0
|
15
|
+
=====
|
16
|
+
|
17
|
+
Breaking Changes
|
18
|
+
|
19
|
+
- Remove Rollbar module (#124)
|
20
|
+
- Remove legacy class setters (#125)
|
21
|
+
|
22
|
+
Other
|
23
|
+
|
24
|
+
- Add support to configure via environment variables (#105)
|
25
|
+
- Adds support for ActionDispatch::RequestId generated request ids (#115)
|
26
|
+
- Changes uuid format to proper uuid (#115)
|
27
|
+
|
28
|
+
0.4.2
|
29
|
+
=====
|
30
|
+
- Ruby 2.0 compatible
|
31
|
+
|
32
|
+
0.4.1
|
33
|
+
=====
|
34
|
+
- Rails 5 support
|
35
|
+
- Remove deprecation warning on timeout setter for Rails apps
|
36
|
+
|
37
|
+
0.4.0
|
38
|
+
=====
|
39
|
+
- Using monotonic time instead of Time.now where available (/ht concurrent-ruby)
|
40
|
+
- Settings are now passable to the middleware initializer instead of class-level
|
41
|
+
- Rollbar module may take a custom fingerprint block
|
42
|
+
- Rollbar module considered final
|
43
|
+
- Fixed an issue where some heartbeats would live on forever (#103, /ht @0x0badc0de)
|
44
|
+
|
45
|
+
0.3.2
|
46
|
+
=====
|
47
|
+
- Fixes calling timeout with a value of 0 (issue #90)
|
48
|
+
|
49
|
+
0.3.1
|
50
|
+
=====
|
51
|
+
- Rollbar module improvements
|
52
|
+
|
53
|
+
0.3.0
|
54
|
+
=====
|
55
|
+
- use a single scheduler thread to manage timeouts, instead of one timeout thread per request
|
56
|
+
- instead of inserting middleware at position 0 for rails, insert before Rack::Runtime (which is right after Rack::Lock and the static file stuff)
|
57
|
+
- reshuffle error types: RequestExpiryError is again a RuntimeError, and timeouts raise a RequestTimeoutException, an Exception, and not descending from Rack::Timeout::Error (see README for more)
|
58
|
+
- don't insert middleware for rails in test environment
|
59
|
+
- add convenience module Rack::Timeout::Logger (see README for more)
|
60
|
+
- StageChangeLoggingObserver renamed to StateChangeLoggingObserver, works slightly differently too
|
61
|
+
- file layout reorganization (see 6e82c276 for details)
|
62
|
+
- CHANGELOG file is now in the gem (@dbackeus)
|
63
|
+
- add optional and experimental support for grouping errors by url under rollbar. see "rack/timeout/rollbar" for usage
|
64
|
+
|
65
|
+
0.2.4
|
66
|
+
=====
|
67
|
+
- Previous fix was borked.
|
68
|
+
|
69
|
+
0.2.3
|
70
|
+
=====
|
71
|
+
- Ignore Rack::NullLogger when picking a logger
|
72
|
+
|
73
|
+
0.2.1
|
74
|
+
=====
|
75
|
+
- Fix raised error messages
|
76
|
+
|
77
|
+
0.2.0
|
78
|
+
=====
|
79
|
+
- Added CHANGELOG
|
80
|
+
- Rack::Timeout::Error now inherits from Exception instead of StandardError, with the hope users won't rescue from it accidentally
|
81
|
+
|
82
|
+
0.1.2
|
83
|
+
=====
|
84
|
+
- improve RequestTimeoutError error string so @watsonian is happy
|
85
|
+
|
86
|
+
0.1.1
|
87
|
+
=====
|
88
|
+
- README updates
|
89
|
+
- fix that setting properties to false resulted in an error
|
90
|
+
|
91
|
+
0.1.0
|
92
|
+
=====
|
93
|
+
- Rewrote README
|
94
|
+
|
95
|
+
0.1.0beta4
|
96
|
+
==========
|
97
|
+
- Renamed `timeout` setting to `service_timeout`; `timeout=` still works for backwards compatibility
|
98
|
+
– `MAX_REQUEST_AGE` is gone, the `wait_timeout` setting more or less replaces it
|
99
|
+
- Renamed `overtime` setting to `wait_overtime`
|
100
|
+
- overtime setting should actually work (It had never made it to beta3)
|
101
|
+
- In the request info struct, renamed `age` to `wait`, `duration` to `service`
|
102
|
+
- Rack::Timeout::StageChangeLogger is gone, replaced by Rack::Timeout::StageChangeLoggingObserver, which is an observer class that composites with a logger, instead of inheriting from Logger. Anything logging related will likely be incompatible with previous beta release.
|
103
|
+
- Log level can no longer be set with env vars, has to be set in the logger being used. (Which can now be custom / user-provided.)
|
104
|
+
|
105
|
+
0.1.0beta1,2,3
|
106
|
+
==============
|
107
|
+
- Dropped ruby 1.8.x support
|
108
|
+
- Dropped rails 2 support
|
109
|
+
- Added rails 4 support
|
110
|
+
- Added much logging
|
111
|
+
– Added support for dropping requests that waited too long in the queue without ever handling them
|
112
|
+
- Other things I can't remember, see git logs :P
|
data/README.md
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
Rack::Timeout
|
2
|
+
=============
|
3
|
+
|
4
|
+
Abort requests that are taking too long; an exception is raised.
|
5
|
+
|
6
|
+
A timeout of 15s is the default. It's recommended to set the timeout as
|
7
|
+
low as realistically viable for your application. You can modify this by
|
8
|
+
setting the `RACK_TIMEOUT_SERVICE_TIMEOUT` environment variable.
|
9
|
+
|
10
|
+
There's a handful of other settings, read on for details.
|
11
|
+
|
12
|
+
Rack::Timeout is not a solution to the problem of long-running requests,
|
13
|
+
it's a debug and remediation tool. App developers should track
|
14
|
+
rack-timeout's data and address recurring instances of particular
|
15
|
+
timeouts, for example by refactoring code so it runs faster or
|
16
|
+
offsetting lengthy work to happen asynchronously.
|
17
|
+
|
18
|
+
Upgrading
|
19
|
+
---------
|
20
|
+
|
21
|
+
For fixing issues when upgrading, please see [UPGRADING](UPGRADING.md).
|
22
|
+
|
23
|
+
Basic Usage
|
24
|
+
-----------
|
25
|
+
|
26
|
+
The following covers currently supported versions of Rails, Rack, Ruby,
|
27
|
+
and Bundler. See the Compatibility section at the end for legacy
|
28
|
+
versions.
|
29
|
+
|
30
|
+
### Rails apps
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
# Gemfile
|
34
|
+
gem "rack-timeout"
|
35
|
+
```
|
36
|
+
|
37
|
+
This will load rack-timeout and set it up as a Rails middleware using
|
38
|
+
the default timeout of 15s. The middleware is not inserted for the test
|
39
|
+
environment. You can modify the timeout by setting a
|
40
|
+
`RACK_TIMEOUT_SERVICE_TIMEOUT` environment variable.
|
41
|
+
|
42
|
+
### Rails apps, manually
|
43
|
+
|
44
|
+
You'll need to do this if you removed `Rack::Runtime` from the
|
45
|
+
middleware stack, or if you want to determine yourself where in the
|
46
|
+
stack `Rack::Timeout` gets inserted.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# Gemfile
|
50
|
+
gem "rack-timeout", require:"rack/timeout/base"
|
51
|
+
```
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# config/initializers/rack_timeout.rb
|
55
|
+
|
56
|
+
# insert middleware wherever you want in the stack, optionally pass
|
57
|
+
# initialization arguments, or use environment variables
|
58
|
+
Rails.application.config.middleware.insert_before Rack::Runtime, Rack::Timeout, service_timeout: 5
|
59
|
+
```
|
60
|
+
|
61
|
+
### Sinatra and other Rack apps
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
# config.ru
|
65
|
+
require "rack-timeout"
|
66
|
+
|
67
|
+
# Call as early as possible so rack-timeout runs before all other middleware.
|
68
|
+
# Setting service_timeout or `RACK_TIMEOUT_SERVICE_TIMEOUT` environment
|
69
|
+
# variable is recommended. If omitted, defaults to 15 seconds.
|
70
|
+
use Rack::Timeout, service_timeout: 5
|
71
|
+
```
|
72
|
+
|
73
|
+
Configuring
|
74
|
+
-----------
|
75
|
+
|
76
|
+
Rack::Timeout takes the following settings, shown here with their
|
77
|
+
default values and associated environment variables.
|
78
|
+
|
79
|
+
```
|
80
|
+
service_timeout: 15 # RACK_TIMEOUT_SERVICE_TIMEOUT
|
81
|
+
wait_timeout: 30 # RACK_TIMEOUT_WAIT_TIMEOUT
|
82
|
+
wait_overtime: 60 # RACK_TIMEOUT_WAIT_OVERTIME
|
83
|
+
service_past_wait: false # RACK_TIMEOUT_SERVICE_PAST_WAIT
|
84
|
+
```
|
85
|
+
|
86
|
+
These settings can be overriden during middleware initialization or
|
87
|
+
environment variables `RACK_TIMEOUT_*` mentioned above. Middleware
|
88
|
+
parameters take precedence:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
use Rack::Timeout, service_timeout: 5, wait_timeout: false
|
92
|
+
```
|
93
|
+
|
94
|
+
For more on these settings, please see [doc/settings](doc/settings.md).
|
95
|
+
|
96
|
+
Further Documentation
|
97
|
+
---------------------
|
98
|
+
|
99
|
+
Please see the [doc](doc) folder for further documentation on:
|
100
|
+
|
101
|
+
* [Risks and shortcomings of using Rack::Timeout](doc/risks.md)
|
102
|
+
* [Understanding the request lifecycle](doc/request-lifecycle.md)
|
103
|
+
* [Exceptions raised by Rack::Timeout](doc/exceptions.md)
|
104
|
+
* [Rollbar fingerprinting](doc/rollbar.md)
|
105
|
+
* [Observers](doc/observers.md)
|
106
|
+
* [Logging](doc/logging.md)
|
107
|
+
|
108
|
+
Compatibility
|
109
|
+
-------------
|
110
|
+
|
111
|
+
This version of Rack::Timeout is compatible with Ruby 2.1 and up, and,
|
112
|
+
for Rails apps, Rails 3.x and up.
|
113
|
+
|
114
|
+
|
115
|
+
---
|
116
|
+
Copyright © 2010-2016 Caio Chassot, released under the MIT license
|
117
|
+
<http://github.com/heroku/rack-timeout>
|
data/UPGRADING.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Upgrading
|
2
|
+
=========
|
3
|
+
|
4
|
+
From 0.4 or older
|
5
|
+
-----------------
|
6
|
+
|
7
|
+
- Removal of the class setters, such as `Rack::Timeout.timeout = 5`, may
|
8
|
+
lead to an error when upgrading. To fix this, remove these setters and
|
9
|
+
instead use either the [environment variables][config-env],
|
10
|
+
`RACK_TIMEOUT_*`, or [insert the middleware manually][config-insert]
|
11
|
+
and configure the middleware as desired when inserting.
|
12
|
+
|
13
|
+
[config-env]: README.md#configuring
|
14
|
+
[config-insert]: README.md#rails-apps-manually
|
15
|
+
|
16
|
+
- The Rollbar support was removed; a deprecation warning will be emitted
|
17
|
+
if you are using this module. The recommendation is to use Rollbar's
|
18
|
+
custom fingerprinting. A recommendation is provided in
|
19
|
+
[doc/rollbar.md](doc/rollbar.md).
|
data/lib/rack-timeout.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require_relative "rack/timeout/base"
|
2
|
-
require_relative "rack/timeout/rails" if defined?(Rails) && [3,4,5].include?(Rails::VERSION::MAJOR)
|
2
|
+
require_relative "rack/timeout/rails" if defined?(Rails) && [3,4,5,6].include?(Rails::VERSION::MAJOR)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-timeout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio Chassot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -59,9 +59,12 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- CHANGELOG.md
|
62
63
|
- Gemfile
|
63
64
|
- MIT-LICENSE
|
65
|
+
- README.md
|
64
66
|
- Rakefile
|
67
|
+
- UPGRADING.md
|
65
68
|
- doc/exceptions.md
|
66
69
|
- doc/logging.md
|
67
70
|
- doc/observers.md
|
@@ -83,10 +86,14 @@ files:
|
|
83
86
|
- test/basic_test.rb
|
84
87
|
- test/env_settings_test.rb
|
85
88
|
- test/test_helper.rb
|
86
|
-
homepage:
|
89
|
+
homepage: https://github.com/sharpstone/rack-timeout
|
87
90
|
licenses:
|
88
91
|
- MIT
|
89
|
-
metadata:
|
92
|
+
metadata:
|
93
|
+
bug_tracker_uri: https://github.com/sharpstone/rack-timeout/issues
|
94
|
+
changelog_uri: https://github.com/sharpstone/rack-timeout/blob/v0.5.2/CHANGELOG.md
|
95
|
+
documentation_uri: https://rubydoc.info/gems/rack-timeout/0.5.2/
|
96
|
+
source_code_uri: https://github.com/sharpstone/rack-timeout
|
90
97
|
post_install_message:
|
91
98
|
rdoc_options: []
|
92
99
|
require_paths:
|
@@ -103,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
110
|
version: '0'
|
104
111
|
requirements: []
|
105
112
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.5.2.3
|
107
114
|
signing_key:
|
108
115
|
specification_version: 4
|
109
116
|
summary: Abort requests that are taking too long
|