My previous refactor introduced bugs into the main loop of queue
processing, specifically how it decides to finish the loop. The
problem is that there are several factors and it's sufficiently
tricky that this was hard to get right.
The logic should now be simpler and more easily understood. We end the
loop once the queue is empty AND the channel notifying us of new
events in the queue haw been closed AND we're no longer running any
adapters.