cutoff 0.5.2 → 1.1.0
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 +29 -1
- data/lib/cutoff/patch/net_http.rb +30 -9
- data/lib/cutoff/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62b041df9110341cc0f55dc67e59098c03caa41f96661bd95a73689e0e508606
|
|
4
|
+
data.tar.gz: c61f6dd25c2781924d9f98bf20ca1deedc701f2d4aae143dad97eae987006a47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 853b7822a150ea5c55b345694919299a839f06d8f414dde5fd285d30789a3a6f4e3da234dc32fafd6411b358827ee0f25184da28fff1140d5d86aca4df7f286c
|
|
7
|
+
data.tar.gz: df37414f0271365e2fdb0adfe5e8a20e805b353f6c37d8b391271edc1ddf4f96a82cf7c340d59ca56c56b722a9873f5031d84f5b6eba5e532a54baa363da1dbd
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.0] - 2026-05-12
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Net::HTTP patch now also re-applies on `begin_transport`, so internal retries
|
|
15
|
+
(Net::HTTP retries idempotent requests once by default on transient errors
|
|
16
|
+
like Net::ReadTimeout) respect the cutoff instead of silently doubling the
|
|
17
|
+
effective deadline.
|
|
18
|
+
|
|
19
|
+
## [1.0.0] - 2026-05-12
|
|
20
|
+
|
|
21
|
+
This release marks Cutoff's API as stable. There are no behavior changes
|
|
22
|
+
since 0.5.2.
|
|
23
|
+
|
|
24
|
+
### Breaking
|
|
25
|
+
|
|
26
|
+
- Drop support for Ruby < 3.1. The minimum supported Ruby is now 3.1.
|
|
27
|
+
`required_ruby_version` in the gemspec has been raised accordingly. #21
|
|
28
|
+
justinhoward
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Modernize CI matrix to Ruby 3.1, 3.2, 3.3, 3.4, jruby-head, and
|
|
33
|
+
truffleruby-head, and update gem dependencies that had rotted out of
|
|
34
|
+
CI in the interim. #21 justinhoward
|
|
35
|
+
|
|
10
36
|
## [0.5.2] - 2022-09-06
|
|
11
37
|
|
|
12
38
|
### Changed
|
|
@@ -81,7 +107,9 @@ to `Timeout::Error`. `CutoffError` changes from a class to a module.
|
|
|
81
107
|
- Cutoff class
|
|
82
108
|
- Mysql2 patch
|
|
83
109
|
|
|
84
|
-
[Unreleased]: https://github.com/justinhoward/cutoff/compare/
|
|
110
|
+
[Unreleased]: https://github.com/justinhoward/cutoff/compare/v1.1.0...HEAD
|
|
111
|
+
[1.1.0]: https://github.com/justinhoward/cutoff/compare/v1.0.0...v1.1.0
|
|
112
|
+
[1.0.0]: https://github.com/justinhoward/cutoff/compare/v0.5.2...v1.0.0
|
|
85
113
|
[0.5.2]: https://github.com/justinhoward/cutoff/compare/v0.5.1...v0.5.2
|
|
86
114
|
[0.5.1]: https://github.com/justinhoward/cutoff/compare/v0.5.0...v0.5.1
|
|
87
115
|
[0.5.0]: https://github.com/justinhoward/cutoff/compare/v0.4.2...v0.5.0
|
|
@@ -25,22 +25,43 @@ class Cutoff
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# Same as the original start, but adds a checkpoint for starting HTTP
|
|
28
|
-
# requests and sets network timeouts to the remaining time
|
|
28
|
+
# requests and sets network timeouts to the remaining time.
|
|
29
|
+
#
|
|
30
|
+
# Also applies the same logic to begin_transport, which is called on
|
|
31
|
+
# every HTTP attempt including internal retries. Net::HTTP#transport_request
|
|
32
|
+
# silently retries idempotent requests (GET, HEAD, PUT, DELETE, OPTIONS,
|
|
33
|
+
# TRACE) up to max_retries (default 1) on transient errors like
|
|
34
|
+
# Net::ReadTimeout. Without re-applying the cutoff in begin_transport,
|
|
35
|
+
# the retry path goes through #connect (not #start), reuses the original
|
|
36
|
+
# read_timeout, and effectively doubles the deadline you set.
|
|
29
37
|
#
|
|
30
38
|
# @method start
|
|
39
|
+
# @method begin_transport
|
|
31
40
|
# @see Net::HTTP#start
|
|
41
|
+
# @see Net::HTTP#begin_transport
|
|
32
42
|
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
|
|
33
43
|
def start
|
|
34
|
-
|
|
35
|
-
remaining = cutoff.seconds_remaining
|
|
36
|
-
#{gen_timeout_method('open_timeout')}
|
|
37
|
-
#{gen_timeout_method('read_timeout')}
|
|
38
|
-
#{gen_timeout_method('write_timeout') if use_write_timeout?}
|
|
39
|
-
#{gen_timeout_method('continue_timeout')}
|
|
40
|
-
Cutoff.checkpoint!(:net_http)
|
|
41
|
-
end
|
|
44
|
+
_cutoff_apply_to_net_http
|
|
42
45
|
super
|
|
43
46
|
end
|
|
47
|
+
|
|
48
|
+
def begin_transport(req)
|
|
49
|
+
_cutoff_apply_to_net_http
|
|
50
|
+
super
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def _cutoff_apply_to_net_http
|
|
56
|
+
return unless (cutoff = Cutoff.current) && cutoff.selected?(:net_http)
|
|
57
|
+
|
|
58
|
+
remaining = cutoff.seconds_remaining
|
|
59
|
+
#{gen_timeout_method('open_timeout')}
|
|
60
|
+
#{gen_timeout_method('read_timeout')}
|
|
61
|
+
#{gen_timeout_method('write_timeout') if use_write_timeout?}
|
|
62
|
+
#{gen_timeout_method('continue_timeout')}
|
|
63
|
+
Cutoff.checkpoint!(:net_http)
|
|
64
|
+
end
|
|
44
65
|
RUBY
|
|
45
66
|
end
|
|
46
67
|
end
|
data/lib/cutoff/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cutoff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Howard
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -58,7 +58,7 @@ dependencies:
|
|
|
58
58
|
- - "<"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '1.0'
|
|
61
|
-
description:
|
|
61
|
+
description:
|
|
62
62
|
email:
|
|
63
63
|
- jmhoward0@gmail.com
|
|
64
64
|
executables: []
|
|
@@ -84,9 +84,9 @@ licenses:
|
|
|
84
84
|
- MIT
|
|
85
85
|
metadata:
|
|
86
86
|
changelog_uri: https://github.com/justinhoward/cutoff/blob/master/CHANGELOG.md
|
|
87
|
-
documentation_uri: https://www.rubydoc.info/gems/cutoff/
|
|
87
|
+
documentation_uri: https://www.rubydoc.info/gems/cutoff/1.1.0
|
|
88
88
|
rubygems_mfa_required: 'true'
|
|
89
|
-
post_install_message:
|
|
89
|
+
post_install_message:
|
|
90
90
|
rdoc_options: []
|
|
91
91
|
require_paths:
|
|
92
92
|
- lib
|
|
@@ -94,15 +94,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
94
94
|
requirements:
|
|
95
95
|
- - ">="
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: '
|
|
97
|
+
version: '3.1'
|
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - ">="
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
102
|
version: '0'
|
|
103
103
|
requirements: []
|
|
104
|
-
rubygems_version: 3.
|
|
105
|
-
signing_key:
|
|
104
|
+
rubygems_version: 3.4.20
|
|
105
|
+
signing_key:
|
|
106
106
|
specification_version: 4
|
|
107
107
|
summary: Deadlines for ruby
|
|
108
108
|
test_files: []
|