It's not locking long enough. There's a step by step demonstration of the race condition in the linked post.
Maybe there is a chance of this occuring with sleep 0.01 but BrowserUk originally had sleeps of 1 -- I doubt this race condition could ever manifest with more than one worker .... esp when you're not using pending (like originally)... but even with the ops changed code and pending
Isn't it simpler to just
for( 1..10 ){ ## make sure we're not between DQ and $busy++
sleep 1;
sleep 1 while $q->pending || $busy;
}
I can't quantify the odds exactly other than to say probably never |