onebusaway-sdk 1.1.3 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: def9ed837e0cb9e3d967a75155f818ad39d5a5649c007e763a958b4ab07d39c1
4
- data.tar.gz: a8f37adbd50e566ea295df17270a4f8436723a2c5890848a9080761e643b6c6f
3
+ metadata.gz: 6cec782a601716df9fff22d3d3ca020dec30bab1b71b1473172e463b0f29dd50
4
+ data.tar.gz: 17cd3c6bec0deec63d992d46e9b1b879836f890b70a0b441b78de4682a8d7ded
5
5
  SHA512:
6
- metadata.gz: 69af154b7157400b173b17cffb3e82e9cc3f442f968b5a9f3c5fcf50031b9a119c2cdaed1de3828dadaebb56870f254903fcad5a7e70e276bcd8ba18497ee648
7
- data.tar.gz: 6047ff2b532c3d41ca7bb4e3eecfdc2da29312d5a02ac947ddbc90d306bbebb99071f750a641f0f037c3417f1e7d69bb025b9216be166129daeff37ad3d11fee
6
+ metadata.gz: cd099d65f113be7a4fe49ec5b04bd7bfac14621f845511c50e6ca1588e49e622495c403f59c083c4720786d0fb7ae7cf488de67e2e1ef9dcfa9a236ce5dc5d84
7
+ data.tar.gz: ae07bb7fff837a48689676dcf1dbf6d2ee1842b905d65010e5b0ed98425985476f8f29ff30a12c5c9d91296f4c8f339d3e84c0c6588d70a2e4a6719160fdea03
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.0 (2025-10-24)
4
+
5
+ Full Changelog: [v1.1.3...v1.2.0](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.3...v1.2.0)
6
+
7
+ ### Features
8
+
9
+ * handle thread interrupts in the core HTTP client ([53092d4](https://github.com/OneBusAway/ruby-sdk/commit/53092d4d8a2665c63273a4190c192ba3382bacb9))
10
+
3
11
  ## 1.1.3 (2025-10-16)
4
12
 
5
13
  Full Changelog: [v1.1.2...v1.1.3](https://github.com/OneBusAway/ruby-sdk/compare/v1.1.2...v1.1.3)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "onebusaway-sdk", "~> 1.1.3"
20
+ gem "onebusaway-sdk", "~> 1.2.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -128,40 +128,48 @@ module OnebusawaySDK
128
128
  url, deadline = request.fetch_values(:url, :deadline)
129
129
 
130
130
  req = nil
131
- eof = false
132
131
  finished = false
133
- closing = nil
134
132
 
135
133
  # rubocop:disable Metrics/BlockLength
136
134
  enum = Enumerator.new do |y|
137
135
  next if finished
138
136
 
139
137
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
138
+ eof = false
139
+ closing = nil
140
+ ::Thread.handle_interrupt(Object => :never) do
141
+ ::Thread.handle_interrupt(Object => :immediate) do
142
+ req, closing = self.class.build_request(request) do
143
+ self.class.calibrate_socket_timeout(conn, deadline)
144
+ end
149
145
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ unless conn.started?
148
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
149
+ conn.start
150
+ end
158
151
 
159
152
  self.class.calibrate_socket_timeout(conn, deadline)
153
+ conn.request(req) do |rsp|
154
+ y << [req, rsp]
155
+ break if finished
156
+
157
+ rsp.read_body do |bytes|
158
+ y << bytes.force_encoding(Encoding::BINARY)
159
+ break if finished
160
+
161
+ self.class.calibrate_socket_timeout(conn, deadline)
162
+ end
163
+ eof = true
164
+ end
165
+ end
166
+ ensure
167
+ begin
168
+ conn.finish if !eof && conn&.started?
169
+ ensure
170
+ closing&.call
160
171
  end
161
- eof = true
162
172
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
173
  end
166
174
  rescue Timeout::Error
167
175
  raise OnebusawaySDK::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +182,6 @@ module OnebusawaySDK
174
182
  body = OnebusawaySDK::Internal::Util.fused_enum(enum, external: true) do
175
183
  finished = true
176
184
  loop { enum.next }
177
- ensure
178
- closing&.call
179
185
  end
180
186
  [Integer(response.code), response, body]
181
187
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnebusawaySDK
4
- VERSION = "1.1.3"
4
+ VERSION = "1.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebusaway-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onebusaway SDK
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-17 00:00:00.000000000 Z
11
+ date: 2025-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool