File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -715,8 +715,14 @@ will never work with more accuracy than 1ms. */
715715 // We cannot trust that the blocking connection stays blocking forever
716716 // due to issues in Redis and IORedis, so we will reconnect if we
717717 // don't get a response in the expected time.
718- timeout = setTimeout ( async ( ) => {
719- bclient . disconnect ( ! this . closing ) ;
718+ timeout = setTimeout ( ( ) => {
719+ // If the event-loop was stuck for more than 1s at the time of completion,
720+ // leading this setTimeout and the bzpopmin below to execute at the same time,
721+ // this function is going to run first. The next setTimeout is there to give
722+ // a bit of room to bzpopmin to resolve if it can.
723+ timeout = setTimeout ( ( ) => {
724+ bclient . disconnect ( ! this . closing ) ;
725+ } , 0 ) ;
720726 } , blockTimeout * 1000 + 1000 ) ;
721727
722728 this . updateDelays ( ) ; // reset delays to avoid reusing same values in next iteration
You can’t perform that action at this time.
0 commit comments