Use IO::Select instead of a sleep of really short duration
Use IO::Select instead of a sleep of really short duration

This avoids unnecessarily polling the sockets when there's nothing to
do, bringing the CPU usage down dramatically.  It also means that we now
have to keep track of the earliest time we need to wake up at in order
to do scheduling correctly.

trustly/pgcronjob