echo "Waiting for next job...\n"; if (!@$worker->wait()) { if ($worker->returnCode() == GEARMAN_NO_ACTIVE_FDS) { # We are not connected to any servers, so wait a bit before # trying to reconnect. sleep(5); continue; } break; } }