async-pool 0.11.0 → 0.11.1
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
- checksums.yaml.gz.sig +0 -0
- data/lib/async/pool/controller.rb +8 -13
- data/lib/async/pool/version.rb +1 -1
- data/lib/traces/provider/async/pool/controller.rb +5 -5
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: f51a25e4bec2c50dc1e0a3dd8b58dcea1deec49d964a1e96c2cb4e1ef4f6de91
|
|
4
|
+
data.tar.gz: 7ae894d17e1b977e20910dab375cf898f76051af6b71a165332143550efbb57c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d92167ce83dec22ac8224c10741bef3595884baeef9fb00c31ef71f7a3cced965d642965c4091902567476ba246cd6bfa1c79d16e3bc5e512e5d120184413c93
|
|
7
|
+
data.tar.gz: 44d97c8ea249bbae96158774832e983f88ceb871979b04ab2626aa962705a3e54210e3edf19e235448a623384bc7382b73e854281fa095c18b97c2d73d067918
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -232,13 +232,13 @@ module Async
|
|
|
232
232
|
|
|
233
233
|
# Retire a specific resource.
|
|
234
234
|
def retire(resource)
|
|
235
|
-
Console.debug(self)
|
|
235
|
+
Console.debug(self){"Retire #{resource}"}
|
|
236
236
|
|
|
237
237
|
@resources.delete(resource)
|
|
238
238
|
|
|
239
239
|
resource.close
|
|
240
240
|
|
|
241
|
-
@mutex.synchronize
|
|
241
|
+
@mutex.synchronize{@condition.broadcast}
|
|
242
242
|
|
|
243
243
|
return true
|
|
244
244
|
end
|
|
@@ -254,12 +254,7 @@ module Async
|
|
|
254
254
|
@gardener = task
|
|
255
255
|
|
|
256
256
|
while true
|
|
257
|
-
|
|
258
|
-
@policy.call(self)
|
|
259
|
-
else
|
|
260
|
-
Task.yield
|
|
261
|
-
end
|
|
262
|
-
|
|
257
|
+
@policy&.call(self)
|
|
263
258
|
self.wait
|
|
264
259
|
end
|
|
265
260
|
ensure
|
|
@@ -287,7 +282,7 @@ module Async
|
|
|
287
282
|
# end
|
|
288
283
|
|
|
289
284
|
def reuse(resource)
|
|
290
|
-
Console.debug(self)
|
|
285
|
+
Console.debug(self){"Reuse #{resource}"}
|
|
291
286
|
|
|
292
287
|
usage = @resources[resource]
|
|
293
288
|
|
|
@@ -302,7 +297,7 @@ module Async
|
|
|
302
297
|
|
|
303
298
|
@resources[resource] = usage - 1
|
|
304
299
|
|
|
305
|
-
@mutex.synchronize
|
|
300
|
+
@mutex.synchronize{@condition.broadcast}
|
|
306
301
|
|
|
307
302
|
return true
|
|
308
303
|
end
|
|
@@ -310,7 +305,7 @@ module Async
|
|
|
310
305
|
def wait_for_resource
|
|
311
306
|
# If we fail to create a resource (below), we will end up waiting for one to become resources.
|
|
312
307
|
until resource = available_resource
|
|
313
|
-
@mutex.synchronize
|
|
308
|
+
@mutex.synchronize{@condition.wait(@mutex)}
|
|
314
309
|
end
|
|
315
310
|
# Be careful not to context switch or fail here.
|
|
316
311
|
return resource
|
|
@@ -360,7 +355,7 @@ module Async
|
|
|
360
355
|
return resource
|
|
361
356
|
end
|
|
362
357
|
end
|
|
363
|
-
@mutex.synchronize
|
|
358
|
+
@mutex.synchronize{@condition.wait(@mutex)}
|
|
364
359
|
end
|
|
365
360
|
# Only when the pool has been completely drained, return nil:
|
|
366
361
|
return nil
|
|
@@ -389,7 +384,7 @@ module Async
|
|
|
389
384
|
end
|
|
390
385
|
|
|
391
386
|
if @limit.nil? or @resources.size < @limit
|
|
392
|
-
Console.debug(self)
|
|
387
|
+
Console.debug(self){"No available resources, allocating new one..."}
|
|
393
388
|
|
|
394
389
|
return create_resource
|
|
395
390
|
end
|
data/lib/async/pool/version.rb
CHANGED
|
@@ -13,7 +13,7 @@ Traces::Provider(Async::Pool::Controller) do
|
|
|
13
13
|
|
|
14
14
|
attributes.merge!(@tags) if @tags
|
|
15
15
|
|
|
16
|
-
Traces.trace("async.pool.create", attributes: attributes)
|
|
16
|
+
Traces.trace("async.pool.create", attributes: attributes){super}
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def drain(...)
|
|
@@ -23,7 +23,7 @@ Traces::Provider(Async::Pool::Controller) do
|
|
|
23
23
|
|
|
24
24
|
attributes.merge!(@tags) if @tags
|
|
25
25
|
|
|
26
|
-
Traces.trace("async.pool.drain", attributes: attributes)
|
|
26
|
+
Traces.trace("async.pool.drain", attributes: attributes){super}
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def acquire(...)
|
|
@@ -34,7 +34,7 @@ Traces::Provider(Async::Pool::Controller) do
|
|
|
34
34
|
|
|
35
35
|
attributes.merge!(@tags) if @tags
|
|
36
36
|
|
|
37
|
-
Traces.trace("async.pool.acquire", attributes: attributes)
|
|
37
|
+
Traces.trace("async.pool.acquire", attributes: attributes){super}
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def release(...)
|
|
@@ -44,7 +44,7 @@ Traces::Provider(Async::Pool::Controller) do
|
|
|
44
44
|
|
|
45
45
|
attributes.merge!(@tags) if @tags
|
|
46
46
|
|
|
47
|
-
Traces.trace("async.pool.release", attributes: attributes)
|
|
47
|
+
Traces.trace("async.pool.release", attributes: attributes){super}
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def retire(...)
|
|
@@ -54,6 +54,6 @@ Traces::Provider(Async::Pool::Controller) do
|
|
|
54
54
|
|
|
55
55
|
attributes.merge!(@tags) if @tags
|
|
56
56
|
|
|
57
|
-
Traces.trace("async.pool.retire", attributes: attributes)
|
|
57
|
+
Traces.trace("async.pool.retire", attributes: attributes){super}
|
|
58
58
|
end
|
|
59
59
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: async-pool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
90
|
version: '0'
|
|
91
91
|
requirements: []
|
|
92
|
-
rubygems_version: 3.6.
|
|
92
|
+
rubygems_version: 3.6.9
|
|
93
93
|
specification_version: 4
|
|
94
94
|
summary: A singleplex and multiplex resource pool for implementing robust clients.
|
|
95
95
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|