internetdata 2.9.1 → 2.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c374167b988f5e3e25dc5d9ea1bcbe8d029e6673821f004ffe80459189f8540
4
- data.tar.gz: 9fe2ecc133b4c759bc750d3f0244be78ed5d61d3da4f8b4dde4824f634ec7967
3
+ metadata.gz: bc736c2ce1797031ec77e9b34bae8cd6c0e61fe00a3a271b8cf74f6121e856fb
4
+ data.tar.gz: 76abfc9509f2d5dacde0e91ab46b50e4c0f55160d8055ea147860d0a04e78cd5
5
5
  SHA512:
6
- metadata.gz: 477a89d599ad03f5b4a1bbad786d5369a192015352b4378e041d66333b254a43ec90e45855bd3baac021150037af69926251ce9f44bc8587034d76bc15da4f21
7
- data.tar.gz: '03769f6734b2ee1fa0b17252916ca2e9f3491abbb713f022b14721c8bbf31d0599447d10062d8e774725d7a26fe1162fb06a0fa2ba93c3bf86c192a27bbf3491'
6
+ metadata.gz: 0152be182d98b622b99cd04ca300d5541e01dfe158eceaa0901050b5d5a0849f2facea74d9780705e891d517f2e9fb777bab29631addbbba9dbd2a012d2ed1a0
7
+ data.tar.gz: 557718e5edbbdc1f724f89136770c0f958d583635ab79a8a18bc035bfe91ecb9071d54349dd1bb81682491f41d6e1f4bf1136c70061027adfc62399c46b079ee
@@ -212,11 +212,18 @@ module InternetData
212
212
  interval = device.interval >= 1 ? device.interval : 5
213
213
  deadline = @now.call + device.expires_in
214
214
  loop do
215
- # A wait that would end past the deadline waits only the time left, never
216
- # a negative remainder, and the local expiry below follows with no request.
215
+ # A wait that would end past the deadline waits only the time left, and the
216
+ # local expiry follows with no request. A remainder not above 0 is none
217
+ # left: a hand-built `expires_in` of NaN compares false with everything, and
218
+ # `[NaN, 0].max` raised a raw ArgumentError (2.9.1).
217
219
  left = deadline - @now.call
218
- @wait.call(interval < left ? interval : [left, 0].max)
219
- raise OauthExpiredTokenError, 'expired_token' if @now.call >= deadline
220
+ left = 0 unless left.positive?
221
+ to_deadline = left <= interval
222
+ @wait.call(to_deadline ? left : interval)
223
+ # A wait that ran to the deadline ends the poll without reading the clock
224
+ # again: a timer can wake before the clock has moved its whole delay, and
225
+ # one more request would then go out at the deadline.
226
+ raise OauthExpiredTokenError, 'expired_token' if to_deadline || @now.call >= deadline
220
227
 
221
228
  begin
222
229
  return exchange_device_code(client_id, device.device_code, timeout: timeout)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InternetData
4
- VERSION = '2.9.1'
4
+ VERSION = '2.9.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internetdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mslm Dev