async 2.45.0 → 2.45.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d9408068579f9a742c20019cf9024bbc4c545c239c4c5178e929c377ac06b6c
4
- data.tar.gz: 699c17d5dbff6502e1611252982c3595b7b84d57284010222462b838e683d1ac
3
+ metadata.gz: f51489757a93062c6aa4ccf5ad1f3c7367c4a374166dc704d42168f13f539c86
4
+ data.tar.gz: 056c11094c9ea4bffc8c5b808a50a3af4bc699b24497cd3f9c8ea3afe3745cfb
5
5
  SHA512:
6
- metadata.gz: a40ca6a441ad341267c5782d089d512b45b36765afbdd1c6382ebb7f931e273cdf29d08ae3a446a0b624618981730c2ee69e15d39adb0956dc44fc1d2ccd2ab9
7
- data.tar.gz: 325d951d894d7c2fb9cc042534e5e8d76c3edbeb81c061993204ef345af499cfd0fd71ebaae0a6fbbdfd62afdf99a859564554c9cb97dcd730111385948aebf1
6
+ metadata.gz: 62c77f5b6dbb84291d2435e0098965d6d78b6dd906f8fd538adb5139240f18dc50484c89b0b7f0772aa0ad85139d3c31a38cbe36425d38f21dec7a310d22cae2
7
+ data.tar.gz: 5e356c8c7754bccece84388bb95ed6f9860924279d5f084673b62c6d0a1b549bdabb19e47b0b05748444b2f43e37d21addf70ed01b39aa5f994531b7676b4648
checksums.yaml.gz.sig CHANGED
Binary file
@@ -307,6 +307,7 @@ module Async
307
307
  # @parameter io [IO] The IO object to wait on.
308
308
  # @parameter events [Integer] The events to wait for, e.g. `IO::READABLE`, `IO::WRITABLE`, etc.
309
309
  # @parameter timeout [Float | Nil] The maximum time to wait, or if nil, indefinitely.
310
+ # @returns [Integer | false] The subset of events that are ready, or `false` if the timeout expires.
310
311
  def io_wait(io, events, timeout = nil)
311
312
  fiber = Fiber.current
312
313
  expired = false
@@ -326,8 +327,8 @@ module Async
326
327
 
327
328
  # A selector wait may return a falsy result when the fiber is resumed without the requested IO becoming ready. For example, a deferred unblock from a previous blocking operation may arrive after the fiber has moved on to this wait. Retry these stale or spurious wake-ups without resetting the original timer.
328
329
  until result = @selector.io_wait(fiber, io, events)
329
- # If the original timer resumed the fiber, the falsy result represents the timeout rather than a spurious wake-up:
330
- return nil if expired
330
+ # If the original timer resumed the fiber, the false result represents the timeout rather than a spurious wake-up:
331
+ return false if expired
331
332
  end
332
333
 
333
334
  return result
@@ -336,16 +337,16 @@ module Async
336
337
  end
337
338
 
338
339
  if ::IO::Event::Support.buffer?
339
- # Read from the specified IO into the buffer.
340
+ # Read at most the specified number of bytes from the IO into the buffer.
340
341
  #
341
342
  # @public Since *Async v2* and Ruby with `IO::Buffer` support.
342
343
  # @asynchronous May be non-blocking.
343
344
  #
344
345
  # @parameter io [IO] The IO object to read from.
345
346
  # @parameter buffer [IO::Buffer] The buffer to read into.
346
- # @parameter length [Integer] The minimum number of bytes to read.
347
347
  # @parameter offset [Integer] The offset within the buffer to read into.
348
- def io_read(io, buffer, length, offset = 0)
348
+ # @parameter length [Integer] The maximum number of bytes to read.
349
+ def io_read(io, buffer, offset, length)
349
350
  fiber = Fiber.current
350
351
 
351
352
  if timeout = io.timeout
@@ -354,22 +355,22 @@ module Async
354
355
  end
355
356
  end
356
357
 
357
- @selector.io_read(fiber, io, buffer, length, offset)
358
+ @selector.io_read(fiber, io, buffer, offset, length)
358
359
  ensure
359
360
  timer&.cancel!
360
361
  end
361
362
 
362
363
  if RUBY_ENGINE != "ruby" || RUBY_VERSION >= "3.3.1"
363
- # Write the specified buffer to the IO.
364
+ # Write at most the specified number of bytes from the buffer to the IO.
364
365
  #
365
366
  # @public Since *Async v2* and *Ruby v3.3.1* with `IO::Buffer` support.
366
367
  # @asynchronous May be non-blocking.
367
368
  #
368
369
  # @parameter io [IO] The IO object to write to.
369
370
  # @parameter buffer [IO::Buffer] The buffer to write from.
370
- # @parameter length [Integer] The minimum number of bytes to write.
371
371
  # @parameter offset [Integer] The offset within the buffer to write from.
372
- def io_write(io, buffer, length, offset = 0)
372
+ # @parameter length [Integer] The maximum number of bytes to write.
373
+ def io_write(io, buffer, offset, length)
373
374
  fiber = Fiber.current
374
375
 
375
376
  if timeout = io.timeout
@@ -378,7 +379,7 @@ module Async
378
379
  end
379
380
  end
380
381
 
381
- @selector.io_write(fiber, io, buffer, length, offset)
382
+ @selector.io_write(fiber, io, buffer, offset, length)
382
383
  ensure
383
384
  timer&.cancel!
384
385
  end
data/lib/async/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
 
6
6
  # @namespace
7
7
  module Async
8
- VERSION = "2.45.0"
8
+ VERSION = "2.45.1"
9
9
  end
data/readme.md CHANGED
@@ -35,6 +35,10 @@ Please see the [project documentation](https://socketry.github.io/async/) for mo
35
35
 
36
36
  Please see the [project releases](https://socketry.github.io/async/releases/index) for all releases.
37
37
 
38
+ ### v2.45.1
39
+
40
+ - Fixed `Scheduler#io_wait` returning `nil` instead of `false` when an explicit timeout expired. Native callers such as `Socket#connect` with `connect_timeout:` distinguish a timeout by checking for `false`, so the `nil` caused `TypeError: no implicit conversion from nil to integer` instead of the intended `IO::TimeoutError`.
41
+
38
42
  ### v2.45.0
39
43
 
40
44
  - Fixed scheduler I/O and process waits returning prematurely after stale or interrupted wake-ups. I/O waits now preserve their original timeout, while blocking process waits retry and non-blocking `Process::WNOHANG` waits still return `nil`.
@@ -72,11 +76,6 @@ Please see the [project releases](https://socketry.github.io/async/releases/inde
72
76
  - Rename `Task#stop` to `Task#cancel` for better clarity and consistency with common concurrency terminology. The old `stop` method is still available as an alias for backward compatibility, but it is recommended to use `cancel` going forward.
73
77
  - Forward arguments from `Task#wait` -\> `Promise#wait`, so `task.wait(timeout: N)` is supported.
74
78
 
75
- ### v2.37.0
76
-
77
- - Introduce `Async::Loop` for robust, time-aligned loops.
78
- - Add support for `Async::Promise#wait(timeout: N)`.
79
-
80
79
  ## See Also
81
80
 
82
81
  - [async-http](https://github.com/socketry/async-http) — Asynchronous HTTP client/server.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v2.45.1
4
+
5
+ - Fixed `Scheduler#io_wait` returning `nil` instead of `false` when an explicit timeout expired. Native callers such as `Socket#connect` with `connect_timeout:` distinguish a timeout by checking for `false`, so the `nil` caused `TypeError: no implicit conversion from nil to integer` instead of the intended `IO::TimeoutError`.
6
+
3
7
  ## v2.45.0
4
8
 
5
9
  - Fixed scheduler I/O and process waits returning prematurely after stale or interrupted wake-ups. I/O waits now preserve their original timeout, while blocking process waits retry and non-blocking `Process::WNOHANG` waits still return `nil`.
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.45.0
4
+ version: 2.45.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file