async-http 0.27.6 → 0.27.7
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/lib/async/http/client.rb +2 -2
- data/lib/async/http/pool.rb +4 -8
- data/lib/async/http/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a30b3776d7094afe5386fa1097e376bb0ba41596917f51a924e79e91531b6ae
|
4
|
+
data.tar.gz: 8ae1a4833d716423edcd207f61d44338c8f6da9919b2a3ec70db559f206f6c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5524c922e52a30bec82c9f686e0ade382d2ecb23b7a41e2cb2df7639458152bb7019dcae05c351fc34698ffdb9e8fa0b5a2d437a4cc1e28df411610c45189d81
|
7
|
+
data.tar.gz: 2d7615f6c95399630973aeff09744ba1153b3eef5916f64b4561868a2639ac9f946487aa66e7f851534643c5a40418eebe116ce1996d3824b9b82a480eb7c877
|
data/lib/async/http/client.rb
CHANGED
@@ -83,7 +83,7 @@ module Async
|
|
83
83
|
return response
|
84
84
|
rescue Protocol::RequestFailed
|
85
85
|
# This is a specific case where the entire request wasn't sent before a failure occurred. So, we can even resend non-idempotent requests.
|
86
|
-
@pool.release(connection)
|
86
|
+
@pool.release(connection) if connection
|
87
87
|
|
88
88
|
attempt += 1
|
89
89
|
if attempt < @retries
|
@@ -92,7 +92,7 @@ module Async
|
|
92
92
|
raise
|
93
93
|
end
|
94
94
|
rescue
|
95
|
-
@pool.release(connection)
|
95
|
+
@pool.release(connection) if connection
|
96
96
|
|
97
97
|
if request.idempotent? and attempt < @retries
|
98
98
|
retry
|
data/lib/async/http/pool.rb
CHANGED
@@ -98,6 +98,7 @@ module Async
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def wait_for_next_available
|
101
|
+
# If we fail to create a resource (below), we will end up waiting for one to become available.
|
101
102
|
until resource = next_available
|
102
103
|
@waiting << Fiber.current
|
103
104
|
Task.yield
|
@@ -107,16 +108,11 @@ module Async
|
|
107
108
|
end
|
108
109
|
|
109
110
|
def create
|
110
|
-
|
111
|
-
|
112
|
-
resource =
|
113
|
-
rescue
|
114
|
-
Async.logger.error "#{$!}: #{$!.backtrace}"
|
115
|
-
return nil
|
111
|
+
# This might return nil, which means creating the resource failed.
|
112
|
+
if resource = @constructor.call
|
113
|
+
@available[resource] = 1
|
116
114
|
end
|
117
115
|
|
118
|
-
@available[resource] = 1
|
119
|
-
|
120
116
|
return resource
|
121
117
|
end
|
122
118
|
|
data/lib/async/http/version.rb
CHANGED