Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
The TimerSet creates a reactor-like loop to pop scheduled tasks off a queue at their appropriate time. If the task's executor has a fallback policy of :abort, the executor can raise a Concurrent::RejectedExecutionError within the loop and break it. This PR introduces a rescue to handle and discard that exception.
I think a RejectedExecutionError is the only exception that the executor is expected to raise, but this could be turned into rescuing any StandardError (either with a rescue or wrapping further in a SafeTaskExecutor (that introduces even more blocks and locks).
Also, this only rescues the exception within the loop that handles future-scheduled tasks. There is a magic 0.01-seconds in the TimerSet which will cause the task to be executed immediately rather than deferred which I did not wrap:
Fixes #889
The TimerSet creates a reactor-like loop to pop scheduled tasks off a queue at their appropriate time. If the task's executor has a fallback policy of
:abort
, the executor can raise aConcurrent::RejectedExecutionError
within the loop and break it. This PR introduces a rescue to handle and discard that exception.I think a
RejectedExecutionError
is the only exception that the executor is expected to raise, but this could be turned into rescuing any StandardError (either with a rescue or wrapping further in aSafeTaskExecutor
(that introduces even more blocks and locks).Also, this only rescues the exception within the loop that handles future-scheduled tasks. There is a magic
0.01
-seconds in the TimerSet which will cause the task to be executed immediately rather than deferred which I did not wrap:https://github.com/ruby-concurrency/concurrent-ruby/blob/ee0ea41a3c66e5c5f578831e4a66d722a40211bd/lib/concurrent-ruby/concurrent/executor/timer_set.rb#L97-L100