When there are no sidekiq jobs available in redis, there are no awaits between when brpopreturns and when the next connection is acquired from the pool. This means tokio's task scheduler doesn't have a chance to switch to another task that's waiting for a connection.
Solution
Add a tokio::task::yield_now().await in the case where there is no actual job to handle. This allows tokio's task scheduler to wake up a different task that's waiting for a connection.
Problem
When there are no sidekiq jobs available in redis, there are no
await
s between whenbrpop
returns and when the next connection is acquired from the pool. This means tokio's task scheduler doesn't have a chance to switch to another task that's waiting for a connection.Solution
Add a
tokio::task::yield_now().await
in the case where there is no actual job to handle. This allows tokio's task scheduler to wake up a different task that's waiting for a connection.https://github.com/film42/sidekiq-rs/issues/43