Optimize main loop a bit to run less hot

If there is nothing in todo/manifest queues, then we don't need to loop
as agressively while waiting on results.

A few other fixes are thrown in as well.

Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
1 file changed