Distribute jobs periodically in background thread

When the server is heavily loaded, the distribute task gets called
too often, leading to DB connection exhaustion and too much
network chatter.