There are times where a timeout in ConnectionPool::TimedStack#pop is an expected result and raising an exception adds unnecessary overhead. Sidekiq uses TimedStack extensively as a blocking primitive so it can sleep for N seconds or be woken up early if the system needs to exit.
https://github.com/sidekiq/sidekiq/blob/67187515db817c7fa77b680d81c8cc48f0fb35ae/lib/sidekiq/scheduled.rb#L117-L120
I propose adding a similiar exception: false option as Ruby's system call, so that #pop will return nil if there was nothing to pop after timeout; this is the happy path for Sidekiq's use case and should cut down on false alarms if there is code in the process monitoring all raised exceptions.
@sleeper.pop(timeout: 30, exception: false)
There are times where a timeout in
ConnectionPool::TimedStack#popis an expected result and raising an exception adds unnecessary overhead. Sidekiq uses TimedStack extensively as a blocking primitive so it can sleep for N seconds or be woken up early if the system needs to exit.https://github.com/sidekiq/sidekiq/blob/67187515db817c7fa77b680d81c8cc48f0fb35ae/lib/sidekiq/scheduled.rb#L117-L120
I propose adding a similiar
exception: falseoption as Ruby'ssystemcall, so that #pop will returnnilif there was nothing to pop after timeout; this is the happy path for Sidekiq's use case and should cut down on false alarms if there is code in the process monitoring all raised exceptions.