minor changes
This commit is contained in:
parent
84f49e310b
commit
aeda915563
|
@ -15,7 +15,7 @@ while (true) {
|
|||
$job = null;
|
||||
|
||||
try {
|
||||
$job = $pheanstalk->reserveWithTimeout(3);
|
||||
$job = $pheanstalk->reserveWithTimeout(10);
|
||||
|
||||
if (is_null($job))
|
||||
throw new Exception("Job is null");
|
||||
|
@ -26,7 +26,7 @@ while (true) {
|
|||
echo date('Y-m-d H:i:s') . ' ' . str_pad($jobPayload->id, 5, " ", STR_PAD_LEFT) . ' ' . $jobPayload->date . PHP_EOL;
|
||||
//echo date('Y-m-d H:i:s') . ' ' . str_pad($jobPayload->id, 5, " ", STR_PAD_LEFT) . ' ' . json_encode($jobPayload) . PHP_EOL;
|
||||
|
||||
usleep(mt_rand(1, 10));
|
||||
usleep(mt_rand(1, 100));
|
||||
//sleep(2);
|
||||
// If it's going to take a long time, periodically
|
||||
// tell beanstalk we're alive to stop it rescheduling the job.
|
||||
|
@ -41,10 +41,13 @@ while (true) {
|
|||
$pheanstalk->release($job);
|
||||
|
||||
if (str_contains($e->getMessage(), 'Connection refused')) {
|
||||
echo 'Beanstalkd server is down';
|
||||
echo 'Beanstalkd server is down' . PHP_EOL;
|
||||
die();
|
||||
} else if (!($e instanceof Exception)) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
} else {
|
||||
echo "Timeout reached." . PHP_EOL;
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user