async 2.10.2 → 2.12.0
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 +3 -4
- data/lib/async/barrier.md +2 -2
- data/lib/async/condition.md +3 -3
- data/lib/async/scheduler.rb +8 -9
- data/lib/async/semaphore.md +2 -2
- data/lib/async/task.rb +6 -5
- data/lib/async/version.rb +1 -1
- data/lib/async/waiter.md +1 -1
- data/readme.md +1 -2
- data.tar.gz.sig +0 -0
- metadata +12 -26
- metadata.gz.sig +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d13c552e4e34cd2b67661c228e727df5d3c7da697e7f59f369e02af5c76e513
|
4
|
+
data.tar.gz: 954607e3c71338fb54fc59d627211a722870a5f8f934c84c113735cf24c24195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 392264144eed819eb93c49e53d2f0de6771cb966314a4e901223138af848fe550be76dd55bcc267db36d2593893e8421193568704987bcaab241171e13003e4c
|
7
|
+
data.tar.gz: 85d97a0013909d6b1be52f73b49fcf3c7610ac59f43ab3794b0959d0266a2c283ea220fb6549fadb13e03be84abc5683988e15b07e607aefc24cca81eeab2479
|
checksums.yaml.gz.sig
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
�
|
2
|
-
�
|
3
|
-
|
4
|
-
Z�y�RC������B���s��2�"�Y0{�f�}n6m�Hg����Y�Dm6�+�]���49��f�蹕-��EG�1�$3lX�J
|
1
|
+
s߃�����e��He���=�ⷖ�3\�C�<ψ �.ﳃQk:�u��fA�Ѵ燱U>7�槟cr��1�w��|����㌫��� !�a�?(B�ɀ!~�����ȩ~�a|��,��A�2=J�\�K/��Љ�[=�W�#�b��Q`�<�2'�tuxA��i��ƃ�Y<9�C S:}�47 1
|
2
|
+
��BjQܦ�z0[�n&moJ����*�$2�T��C�PxXYoQwpl��������7�jr8V���(\�||�ӷ�3[�#� t~>�������'s�f�.�S��B��yV{V�6{���\��䯑SI��2�x"���.��
|
3
|
+
�H� ��gug��wJW�Y|����dc�-�Ʀx%.m!k�L
|
data/lib/async/barrier.md
CHANGED
@@ -9,7 +9,7 @@ require 'async/barrier'
|
|
9
9
|
|
10
10
|
barrier = Async::Barrier.new
|
11
11
|
Sync do
|
12
|
-
Console.
|
12
|
+
Console.info("Barrier Example: sleep sort.")
|
13
13
|
|
14
14
|
# Generate an array of 10 numbers:
|
15
15
|
numbers = 10.times.map{rand(10)}
|
@@ -26,7 +26,7 @@ Sync do
|
|
26
26
|
# Wait for all the numbers to be sorted:
|
27
27
|
barrier.wait
|
28
28
|
|
29
|
-
Console.
|
29
|
+
Console.info("Sorted", sorted)
|
30
30
|
ensure
|
31
31
|
# Ensure all the tasks are stopped when we exit:
|
32
32
|
barrier.stop
|
data/lib/async/condition.md
CHANGED
@@ -9,14 +9,14 @@ Sync do
|
|
9
9
|
condition = Async::Condition.new
|
10
10
|
|
11
11
|
Async do
|
12
|
-
Console.
|
12
|
+
Console.info "Waiting for condition..."
|
13
13
|
value = condition.wait
|
14
|
-
Console.
|
14
|
+
Console.info "Condition was signalled: #{value}"
|
15
15
|
end
|
16
16
|
|
17
17
|
Async do |task|
|
18
18
|
task.sleep(1)
|
19
|
-
Console.
|
19
|
+
Console.info "Signalling condition..."
|
20
20
|
condition.signal("Hello World")
|
21
21
|
end
|
22
22
|
end
|
data/lib/async/scheduler.rb
CHANGED
@@ -11,7 +11,6 @@ require_relative 'task'
|
|
11
11
|
require 'io/event'
|
12
12
|
|
13
13
|
require 'console'
|
14
|
-
require 'timers'
|
15
14
|
require 'resolv'
|
16
15
|
|
17
16
|
module Async
|
@@ -40,7 +39,7 @@ module Async
|
|
40
39
|
@busy_time = 0.0
|
41
40
|
@idle_time = 0.0
|
42
41
|
|
43
|
-
@timers = ::Timers
|
42
|
+
@timers = ::IO::Event::Timers.new
|
44
43
|
end
|
45
44
|
|
46
45
|
# Compute the scheduler load according to the busy and idle times that are updated by the run loop.
|
@@ -165,7 +164,7 @@ module Async
|
|
165
164
|
@blocked -= 1
|
166
165
|
end
|
167
166
|
ensure
|
168
|
-
timer&.cancel
|
167
|
+
timer&.cancel!
|
169
168
|
end
|
170
169
|
|
171
170
|
# @asynchronous May be called from any thread.
|
@@ -225,7 +224,7 @@ module Async
|
|
225
224
|
|
226
225
|
return @selector.io_wait(fiber, io, events)
|
227
226
|
ensure
|
228
|
-
timer&.cancel
|
227
|
+
timer&.cancel!
|
229
228
|
end
|
230
229
|
|
231
230
|
if ::IO::Event::Support.buffer?
|
@@ -240,7 +239,7 @@ module Async
|
|
240
239
|
|
241
240
|
@selector.io_read(fiber, io, buffer, length, offset)
|
242
241
|
ensure
|
243
|
-
timer&.cancel
|
242
|
+
timer&.cancel!
|
244
243
|
end
|
245
244
|
|
246
245
|
if RUBY_ENGINE != "ruby" || RUBY_VERSION >= "3.3.1"
|
@@ -255,7 +254,7 @@ module Async
|
|
255
254
|
|
256
255
|
@selector.io_write(fiber, io, buffer, length, offset)
|
257
256
|
ensure
|
258
|
-
timer&.cancel
|
257
|
+
timer&.cancel!
|
259
258
|
end
|
260
259
|
end
|
261
260
|
end
|
@@ -369,7 +368,7 @@ module Async
|
|
369
368
|
|
370
369
|
return initial_task
|
371
370
|
ensure
|
372
|
-
Console.
|
371
|
+
Console.debug(self) {"Exiting run-loop because #{$! ? $! : 'finished'}."}
|
373
372
|
end
|
374
373
|
|
375
374
|
# Start an asynchronous task within the specified reactor. The task will be
|
@@ -395,7 +394,7 @@ module Async
|
|
395
394
|
# - Avoid scheduler overhead if no blocking operation is performed.
|
396
395
|
task.run(*arguments)
|
397
396
|
|
398
|
-
# Console.
|
397
|
+
# Console.debug "Initial execution of task #{fiber} complete (#{result} -> #{fiber.alive?})..."
|
399
398
|
return task
|
400
399
|
end
|
401
400
|
|
@@ -416,7 +415,7 @@ module Async
|
|
416
415
|
|
417
416
|
yield timer
|
418
417
|
ensure
|
419
|
-
timer
|
418
|
+
timer&.cancel!
|
420
419
|
end
|
421
420
|
|
422
421
|
def timeout_after(duration, exception, message, &block)
|
data/lib/async/semaphore.md
CHANGED
@@ -17,9 +17,9 @@ Sync do
|
|
17
17
|
# Search for the terms:
|
18
18
|
terms.each do |term|
|
19
19
|
semaphore.async do |task|
|
20
|
-
Console.
|
20
|
+
Console.info("Searching for #{term}...")
|
21
21
|
response = Net::HTTP.get(URI "https://www.google.com/search?q=#{term}")
|
22
|
-
Console.
|
22
|
+
Console.info("Got response #{response.size} bytes.")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/async/task.rb
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
# Copyright, 2023, by Math Ieu.
|
9
9
|
|
10
10
|
require 'fiber'
|
11
|
+
require 'console/event/failure'
|
11
12
|
|
12
13
|
require_relative 'node'
|
13
14
|
require_relative 'condition'
|
@@ -335,15 +336,15 @@ module Async
|
|
335
336
|
raise exception
|
336
337
|
elsif @finished.nil?
|
337
338
|
# If no one has called wait, we log this as a warning:
|
338
|
-
Console.
|
339
|
+
Console::Event::Failure.for(exception).emit(self, "Task may have ended with unhandled exception.", severity: :warn)
|
339
340
|
else
|
340
|
-
Console.
|
341
|
+
Console::Event::Failure.for(exception).emit(self, severity: :debug)
|
341
342
|
end
|
342
343
|
end
|
343
344
|
end
|
344
345
|
|
345
346
|
def stopped!
|
346
|
-
# Console.
|
347
|
+
# Console.info(self, status:) {"Task #{self} was stopped with #{@children&.size.inspect} children!"}
|
347
348
|
@status = :stopped
|
348
349
|
|
349
350
|
stopped = false
|
@@ -374,7 +375,7 @@ module Async
|
|
374
375
|
|
375
376
|
begin
|
376
377
|
completed!(yield)
|
377
|
-
# Console.
|
378
|
+
# Console.debug(self) {"Task was completed with #{@children.size} children!"}
|
378
379
|
rescue Stop
|
379
380
|
stopped!
|
380
381
|
rescue StandardError => error
|
@@ -382,7 +383,7 @@ module Async
|
|
382
383
|
rescue Exception => exception
|
383
384
|
failed!(exception, true)
|
384
385
|
ensure
|
385
|
-
# Console.
|
386
|
+
# Console.info(self) {"Task ensure $! = #{$!} with #{@children&.size.inspect} children!"}
|
386
387
|
finish!
|
387
388
|
end
|
388
389
|
end
|
data/lib/async/version.rb
CHANGED
data/lib/async/waiter.md
CHANGED
data/readme.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# ![Async](logo.svg)
|
2
2
|
|
3
|
-
Async is a composable asynchronous I/O framework for Ruby based on [io-event](https://github.com/socketry/io-event)
|
4
|
-
[timers](https://github.com/socketry/timers).
|
3
|
+
Async is a composable asynchronous I/O framework for Ruby based on [io-event](https://github.com/socketry/io-event).
|
5
4
|
|
6
5
|
> "Lately I've been looking into `async`, as one of my projects –
|
7
6
|
> [tus-ruby-server](https://github.com/janko/tus-ruby-server) – would really benefit from non-blocking I/O. It's really
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -62,7 +62,7 @@ cert_chain:
|
|
62
62
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
63
63
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
64
64
|
-----END CERTIFICATE-----
|
65
|
-
date: 2024-04
|
65
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
66
66
|
dependencies:
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: console
|
@@ -70,14 +70,20 @@ dependencies:
|
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '1.
|
73
|
+
version: '1.25'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.25.2
|
74
77
|
type: :runtime
|
75
78
|
prerelease: false
|
76
79
|
version_requirements: !ruby/object:Gem::Requirement
|
77
80
|
requirements:
|
78
81
|
- - "~>"
|
79
82
|
- !ruby/object:Gem::Version
|
80
|
-
version: '1.
|
83
|
+
version: '1.25'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 1.25.2
|
81
87
|
- !ruby/object:Gem::Dependency
|
82
88
|
name: fiber-annotation
|
83
89
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,34 +104,14 @@ dependencies:
|
|
98
104
|
requirements:
|
99
105
|
- - "~>"
|
100
106
|
- !ruby/object:Gem::Version
|
101
|
-
version: '1.
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 1.5.1
|
105
|
-
type: :runtime
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '1.5'
|
112
|
-
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: 1.5.1
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: timers
|
117
|
-
requirement: !ruby/object:Gem::Requirement
|
118
|
-
requirements:
|
119
|
-
- - "~>"
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version: '4.1'
|
107
|
+
version: '1.6'
|
122
108
|
type: :runtime
|
123
109
|
prerelease: false
|
124
110
|
version_requirements: !ruby/object:Gem::Requirement
|
125
111
|
requirements:
|
126
112
|
- - "~>"
|
127
113
|
- !ruby/object:Gem::Version
|
128
|
-
version: '
|
114
|
+
version: '1.6'
|
129
115
|
description:
|
130
116
|
email:
|
131
117
|
executables: []
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
^q*(�(���x$&��6���:P��,ÀYV4���n@ L�o9*Iy#I`c|73
|
2
|
+
Dž@{�����,t$)�*�_���x�L�х�~Յ�LM���ޝ�9���e�V����hi8�u�1f�ܫ�2��w=+\
|
3
|
+
s������b��j�L���fm�� 峅��8f�h1I���`��2NRS,�dy����@
|