rack-timeout 0.6.0 → 0.6.3
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +2 -2
- data/doc/settings.md +1 -1
- data/lib/rack/timeout/core.rb +1 -4
- data/lib/rack/timeout/logging-observer.rb +1 -1
- data/lib/rack-timeout.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9227dd3e15be49573b85cff836c363d2046d91167d7a3f5731f7002550912beb
|
4
|
+
data.tar.gz: 5454236eff00e74096e5d6818ff80fc0663d12d3f52848847e5fefb02d5110cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb616f8274f70fffc7a0aef4c4ffc8bcadba8fd0968a58980e2027c3b7131aebf34f49c5d8cf7f69d871deccb27785dc671524501b7021a5f152314a62a4309
|
7
|
+
data.tar.gz: 0ce8bf83eb28973c064a56da114c32276dcc5961a5a761f46850c0e48d39170361f1dcb6ac483e1284bf703c819ba6c84a8b2c6329a207b03266b558e37b87d0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## HEAD (unreleased)
|
2
|
+
|
3
|
+
## 0.6.3
|
4
|
+
|
5
|
+
- Fix `NoMethodError: undefined method 'logger' for Rails:Module` when Rails is defined as a Module, but is not a full Rails app (https://github.com/zombocom/rack-timeout/pull/180)
|
6
|
+
|
7
|
+
## 0.6.2
|
8
|
+
|
9
|
+
- Migrate CI from Travis CI to GitHub Actions (https://github.com/zombocom/rack-timeout/pull/182)
|
10
|
+
- Rails 7+ support (https://github.com/zombocom/rack-timeout/pull/184)
|
11
|
+
|
12
|
+
## 0.6.1
|
13
|
+
|
14
|
+
- RACK_TIMEOUT_TERM_ON_TIMEOUT can be set to zero to disable (https://github.com/sharpstone/rack-timeout/pull/161)
|
15
|
+
- Update the gemspec's homepage to the current repo URL(https://github.com/zombocom/rack-timeout/pull/183)
|
16
|
+
|
1
17
|
## 0.6.0
|
2
18
|
|
3
19
|
- Allow sending SIGTERM to workers on timeout (https://github.com/sharpstone/rack-timeout/pull/157)
|
data/README.md
CHANGED
@@ -114,5 +114,5 @@ for Rails apps, Rails 3.x and up.
|
|
114
114
|
|
115
115
|
|
116
116
|
---
|
117
|
-
Copyright © 2010-
|
118
|
-
<http://github.com/
|
117
|
+
Copyright © 2010-2020 Caio Chassot, released under the MIT license
|
118
|
+
<http://github.com/sharpstone/rack-timeout>
|
data/doc/settings.md
CHANGED
@@ -59,7 +59,7 @@ If your application timeouts fire frequently then [they can cause your applicati
|
|
59
59
|
|
60
60
|
After the worker process exists will Puma's parent process know to boot a replacement worker. While one process is restarting, another can still serve requests (if you have more than 1 worker process per server/dyno). Between when a process exits and when a new process boots, there will be a reduction in throughput. If all processes are restarting, then incoming requests will be blocked while new processes boot.
|
61
61
|
|
62
|
-
**How to enable** To enable this behavior you can set `term_on_timeout: 1` to an integer value. If you set it to
|
62
|
+
**How to enable** To enable this behavior you can set `term_on_timeout: 1` to an integer value. If you set it to one, then the first time the process encounters a timeout, it will receive a SIGTERM.
|
63
63
|
|
64
64
|
To enable on Heroku run:
|
65
65
|
|
data/lib/rack/timeout/core.rb
CHANGED
@@ -53,8 +53,6 @@ module Rack
|
|
53
53
|
when nil ; read_timeout_property default, default
|
54
54
|
when false ; false
|
55
55
|
when 0 ; false
|
56
|
-
when String
|
57
|
-
read_timeout_property value.to_i, default
|
58
56
|
else
|
59
57
|
value.is_a?(Numeric) && value > 0 or raise ArgumentError, "value #{value.inspect} should be false, zero, or a positive number."
|
60
58
|
value
|
@@ -69,7 +67,7 @@ module Rack
|
|
69
67
|
:term_on_timeout
|
70
68
|
|
71
69
|
def initialize(app, service_timeout:nil, wait_timeout:nil, wait_overtime:nil, service_past_wait:"not_specified", term_on_timeout: nil)
|
72
|
-
@term_on_timeout = read_timeout_property term_on_timeout, ENV.fetch("RACK_TIMEOUT_TERM_ON_TIMEOUT",
|
70
|
+
@term_on_timeout = read_timeout_property term_on_timeout, ENV.fetch("RACK_TIMEOUT_TERM_ON_TIMEOUT", 0).to_i
|
73
71
|
@service_timeout = read_timeout_property service_timeout, ENV.fetch("RACK_TIMEOUT_SERVICE_TIMEOUT", 15).to_i
|
74
72
|
@wait_timeout = read_timeout_property wait_timeout, ENV.fetch("RACK_TIMEOUT_WAIT_TIMEOUT", 30).to_i
|
75
73
|
@wait_overtime = read_timeout_property wait_overtime, ENV.fetch("RACK_TIMEOUT_WAIT_OVERTIME", 60).to_i
|
@@ -77,7 +75,6 @@ module Rack
|
|
77
75
|
|
78
76
|
Thread.main['RACK_TIMEOUT_COUNT'] ||= 0
|
79
77
|
if @term_on_timeout
|
80
|
-
raise "term_on_timeout must be an integer but is #{@term_on_timeout.class}: #{@term_on_timeout}" unless @term_on_timeout.is_a?(Numeric)
|
81
78
|
raise "Current Runtime does not support processes" unless ::Process.respond_to?(:fork)
|
82
79
|
end
|
83
80
|
@app = app
|
@@ -32,7 +32,7 @@ class Rack::Timeout::StateChangeLoggingObserver
|
|
32
32
|
|
33
33
|
def logger(env = nil)
|
34
34
|
@logger ||
|
35
|
-
(defined?(::Rails) && ::Rails.logger) ||
|
35
|
+
(defined?(::Rails) && ::Rails.respond_to?(:logger) && ::Rails.logger) ||
|
36
36
|
(env && !env["rack.logger"].is_a?(::Rack::NullLogger) && env["rack.logger"]) ||
|
37
37
|
(env && env["rack.errors"] && self.class.mk_logger(env["rack.errors"])) ||
|
38
38
|
(@fallback_logger ||= self.class.mk_logger($stderr))
|
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) &&
|
2
|
+
require_relative "rack/timeout/rails" if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
data/test/test_helper.rb
CHANGED
@@ -15,7 +15,7 @@ class RackTimeoutTest < Test::Unit::TestCase
|
|
15
15
|
def app
|
16
16
|
settings = self.settings
|
17
17
|
Rack::Builder.new do
|
18
|
-
use Rack::Timeout, settings
|
18
|
+
use Rack::Timeout, **settings
|
19
19
|
|
20
20
|
map "/" do
|
21
21
|
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['OK']] }
|
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.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio Chassot
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -86,15 +86,15 @@ files:
|
|
86
86
|
- test/basic_test.rb
|
87
87
|
- test/env_settings_test.rb
|
88
88
|
- test/test_helper.rb
|
89
|
-
homepage: https://github.com/
|
89
|
+
homepage: https://github.com/zombocom/rack-timeout
|
90
90
|
licenses:
|
91
91
|
- MIT
|
92
92
|
metadata:
|
93
|
-
bug_tracker_uri: https://github.com/
|
94
|
-
changelog_uri: https://github.com/
|
95
|
-
documentation_uri: https://rubydoc.info/gems/rack-timeout/0.6.
|
96
|
-
source_code_uri: https://github.com/
|
97
|
-
post_install_message:
|
93
|
+
bug_tracker_uri: https://github.com/zombocom/rack-timeout/issues
|
94
|
+
changelog_uri: https://github.com/zombocom/rack-timeout/blob/v0.6.3/CHANGELOG.md
|
95
|
+
documentation_uri: https://rubydoc.info/gems/rack-timeout/0.6.3/
|
96
|
+
source_code_uri: https://github.com/zombocom/rack-timeout
|
97
|
+
post_install_message:
|
98
98
|
rdoc_options: []
|
99
99
|
require_paths:
|
100
100
|
- lib
|
@@ -109,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
112
|
+
rubygems_version: 3.3.7
|
113
|
+
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Abort requests that are taking too long
|
116
116
|
test_files:
|