async 2.11.0 → 2.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43ab9833acc38ebf7eff4ef5e37401c5d9aff7f668eb71e77547666c1ddee9b8
4
- data.tar.gz: f18b2eec51ff8bb163b91e6ed5583a8bbbbc0a985ff35738ae0c79aa37913687
3
+ metadata.gz: 1eef4bf800b6d52c0f273289186f9886975237ecdf9885f599617691283ca2e5
4
+ data.tar.gz: 14a7e20dc72c178b89a93233a73fd49f182f7aec7926804b9b8bf37e8ceb9f36
5
5
  SHA512:
6
- metadata.gz: f07fafe843aea1930627b51f1dd4ba3c0a698f960282381a09c6955a79aeb5ab774d0f89b9680a4cf9bd84fa15c8a50fe9b2bce8bce0c5e6f0e655cbfe39988e
7
- data.tar.gz: b4ec7cfe3d51ed349f72993b862a01738341a0603833df75188dd8a43d714e1b1ede85f97bcbaebe17027a4cd1992d1cb617d41d4773b04da447080701e94a71
6
+ metadata.gz: 30176358a5c9efc3df3e525e0ba941f5771bb7619bef28e1b6229a547ad3a24cb5475483a257704c3eea2d9214dcca2e17932994e0859a1c5d4dfc6401b24d48
7
+ data.tar.gz: 8b7353cf2ef0884c78a919775b84280d3234c7868c6c3b95aa00ae560a5825a07bd9533eda1afcc9776d1c94b7cc116e549e24144e4bab7c9bb3f086782a7456
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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::Group.new
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
@@ -347,6 +346,7 @@ module Async
347
346
  Kernel::raise ClosedError if @selector.nil?
348
347
 
349
348
  initial_task = self.async(...) if block_given?
349
+ interrupt = nil
350
350
 
351
351
  begin
352
352
  # In theory, we could use Exception here to be a little bit safer, but we've only shown the case for SignalException to be a problem, so let's not over-engineer this.
@@ -359,14 +359,17 @@ module Async
359
359
  break unless self.run_once
360
360
  end
361
361
  end
362
- rescue Interrupt
362
+ rescue Interrupt => interrupt
363
363
  Thread.handle_interrupt(::SignalException => :never) do
364
364
  self.stop
365
365
  end
366
366
 
367
367
  retry
368
368
  end
369
-
369
+
370
+ # If the event loop was interrupted, and we finished exiting normally (due to the interrupt), we need to re-raise the interrupt so that the caller can handle it too.
371
+ Kernel.raise interrupt if interrupt
372
+
370
373
  return initial_task
371
374
  ensure
372
375
  Console.debug(self) {"Exiting run-loop because #{$! ? $! : 'finished'}."}
@@ -416,7 +419,7 @@ module Async
416
419
 
417
420
  yield timer
418
421
  ensure
419
- timer.cancel if timer
422
+ timer&.cancel!
420
423
  end
421
424
 
422
425
  def timeout_after(duration, exception, message, &block)
data/lib/async/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2017-2024, by Samuel Williams.
5
5
 
6
6
  module Async
7
- VERSION = "2.11.0"
7
+ VERSION = "2.12.1"
8
8
  end
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) and
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.11.0
4
+ version: 2.12.1
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-05-04 00:00:00.000000000 Z
65
+ date: 2024-06-23 00:00:00.000000000 Z
66
66
  dependencies:
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: console
@@ -104,34 +104,20 @@ dependencies:
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '1.5'
107
+ version: '1.6'
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.5.1
110
+ version: 1.6.5
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.5'
117
+ version: '1.6'
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
- version: 1.5.1
121
- - !ruby/object:Gem::Dependency
122
- name: timers
123
- requirement: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - "~>"
126
- - !ruby/object:Gem::Version
127
- version: '4.1'
128
- type: :runtime
129
- prerelease: false
130
- version_requirements: !ruby/object:Gem::Requirement
131
- requirements:
132
- - - "~>"
133
- - !ruby/object:Gem::Version
134
- version: '4.1'
120
+ version: 1.6.5
135
121
  description:
136
122
  email:
137
123
  executables: []
@@ -186,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
172
  - !ruby/object:Gem::Version
187
173
  version: '0'
188
174
  requirements: []
189
- rubygems_version: 3.5.3
175
+ rubygems_version: 3.5.11
190
176
  signing_key:
191
177
  specification_version: 4
192
178
  summary: A concurrency framework for Ruby.
metadata.gz.sig CHANGED
Binary file