Skip to content

Commit

Permalink
Better handling of internal timeout in io_wait.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Aug 25, 2023
1 parent bc9deca commit 723d2a2
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/async/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,11 @@ def io_wait(io, events, timeout = nil)

if timeout
timer = @timers.after(timeout) do
fiber.raise(TimeoutError)
fiber.transfer
end
end

# Console.logger.info(self, "-> io_wait", fiber, io, events)
events = @selector.io_wait(fiber, io, events)
# Console.logger.info(self, "<- io_wait", fiber, io, events)

return events
rescue TimeoutError
return false
return @selector.io_wait(fiber, io, events)
ensure
timer&.cancel
end
Expand Down

0 comments on commit 723d2a2

Please sign in to comment.