async-rest 0.19.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data/lib/async/rest/version.rb +1 -1
- data/lib/async/rest/wrapper/generic.rb +10 -3
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae3aeb21790cedb9bbbe38afbf40b3d5990b28cb1a6eaf076495fab5a25a77e1
|
4
|
+
data.tar.gz: 4c8fd49d8c4be1fe367f62fe50231f527ad9fb440a8533d40e34e4bd15fe5c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf1569c2fb59d7e216d3e677504e2b846cd3d47bf3411d55c5027c8cfb26334d3946996bb2e2c9e0180b2b040d543a6fa806a4af6e7952888387cce2f80b1dc2
|
7
|
+
data.tar.gz: 1fe580a38cc6a60d43943eb64ff28efddf32e3399b43c371fafeb7e6f6d39263bf66c45c2148742eaf628bfa5a6f123933859b2052f87b23c4e2e3b259a32737
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
�ڕ���\M�i+�A\�՝�k��e�$�#C3�bS�x���l��|�U�����
|
3
|
-
L��7��K���#�~_��(b���L��)Kc{�0N�cZ����SWY�lUR��yJ��JF����2�)��(�N<�\��v
|
1
|
+
4`��ٍt��z�pged�Y�k\�K$bXr�������v0���V��Mb�B�jV˄l*[ǐ�o�=WI�TZY����P�=.���7�����E���`�M��odc��բ7)i�� ^��y����i��`�ħF۔©�*\�&C^'9�W�P骽�뺌��]5���DZe�)�CI��)�i�����_���ٳ��#��B�\[AV�:�(�LJ�l��e*�V�:�/��%V?�O4fj����p�����k�JZ���'`��k2�,�<!��I��yH������*{Y�]Z��A�<7� �~��kf��(��}�����Ѕ�Ȭ�=��+����OW�h��s�h�#_�i���щ�F�؍^����<
|
data/lib/async/rest/version.rb
CHANGED
@@ -7,13 +7,20 @@ module Async
|
|
7
7
|
module REST
|
8
8
|
module Wrapper
|
9
9
|
class Generic
|
10
|
-
|
10
|
+
def retry_after_duration(value)
|
11
|
+
retry_after_time = Time.httpdate(value)
|
12
|
+
return [retry_after_time - Time.now, 0].max
|
13
|
+
rescue ArgumentError
|
14
|
+
return value.to_f
|
15
|
+
end
|
16
|
+
|
17
|
+
def response_for(resource, request)
|
11
18
|
while true
|
12
19
|
response = resource.call(request)
|
13
20
|
|
14
21
|
if response.status == 429
|
15
22
|
if retry_after = response.headers["retry-after"]
|
16
|
-
sleep(retry_after
|
23
|
+
sleep(retry_after_duration(retry_after))
|
17
24
|
else
|
18
25
|
# Without the `retry-after` header, we can't determine how long to wait, so we just return the response.
|
19
26
|
return response
|
@@ -59,7 +66,7 @@ module Async
|
|
59
66
|
|
60
67
|
def parser_for(response)
|
61
68
|
# It's not always clear why this error is being thrown.
|
62
|
-
return
|
69
|
+
return nil
|
63
70
|
end
|
64
71
|
|
65
72
|
# Wrap the response body in the given klass.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -62,14 +62,14 @@ dependencies:
|
|
62
62
|
requirements:
|
63
63
|
- - "~>"
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: '0.
|
65
|
+
version: '0.45'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
72
|
+
version: '0.45'
|
73
73
|
description:
|
74
74
|
email:
|
75
75
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|