cutoff 1.0.0 → 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 +11 -1
- data/lib/cutoff/patch/net_http.rb +30 -9
- data/lib/cutoff/version.rb +1 -1
- metadata +2 -2
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,15 @@ 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
|
+
|
|
10
19
|
## [1.0.0] - 2026-05-12
|
|
11
20
|
|
|
12
21
|
This release marks Cutoff's API as stable. There are no behavior changes
|
|
@@ -98,7 +107,8 @@ to `Timeout::Error`. `CutoffError` changes from a class to a module.
|
|
|
98
107
|
- Cutoff class
|
|
99
108
|
- Mysql2 patch
|
|
100
109
|
|
|
101
|
-
[Unreleased]: https://github.com/justinhoward/cutoff/compare/v1.
|
|
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
|
|
102
112
|
[1.0.0]: https://github.com/justinhoward/cutoff/compare/v0.5.2...v1.0.0
|
|
103
113
|
[0.5.2]: https://github.com/justinhoward/cutoff/compare/v0.5.1...v0.5.2
|
|
104
114
|
[0.5.1]: https://github.com/justinhoward/cutoff/compare/v0.5.0...v0.5.1
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cutoff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Howard
|
|
@@ -84,7 +84,7 @@ 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/1.
|
|
87
|
+
documentation_uri: https://www.rubydoc.info/gems/cutoff/1.1.0
|
|
88
88
|
rubygems_mfa_required: 'true'
|
|
89
89
|
post_install_message:
|
|
90
90
|
rdoc_options: []
|