Skip to content

Commit 46b6dcb

Browse files
Avoid exceptions when waking events.
Assisted-By: devx/3236e566-7538-432e-a30a-2bdf37265ed4
1 parent 76c2402 commit 46b6dcb

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

lib/async/container/events.rb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ def initialize
2525
def <<(event)
2626
@queue << event
2727

28-
begin
29-
@output.write_nonblock(".")
30-
rescue ::IO::WaitWritable
31-
# The pipe is already full, so any select waiter is already awake:
32-
end
28+
# If the pipe is full, any select waiter is already awake:
29+
@output.write_nonblock(".", exception: false)
3330

3431
return self
3532
end
@@ -46,13 +43,9 @@ def pop(non_block = false, timeout: nil)
4643

4744
return unless event
4845

49-
@input.read_nonblock(1)
46+
@input.read_nonblock(1, exception: false)
5047

5148
return event
52-
rescue ::IO::WaitReadable
53-
return event if event
54-
55-
raise
5649
end
5750
end
5851
end

0 commit comments

Comments
 (0)