예제 #1
0
            } else {
                // Do not expect this to occur.
                LogHelper::log_notice("{$log_id}: Could not claim the Job {$job_id}.");
                LogHelper::log_notice("{$log_id}: Started udpating failed status(COULD NOT CLAIM THE JOB) 3 for job {$job_id}.");
                $job_details = array('status' => 3, 'end_time' => time());
                $job_log = "~~{$log_id}: COULD NOT CLAIM THE JOB on " . date("m-d-Y, H:i:s");
                QueueUtil::updateJobDetails($job_id, $job_details, $job_log);
                LogHelper::log_notice("{$log_id}: Completed udpating failed status(COULD NOT CLAIM THE JOB) 3 for job {$job_id}.");
            }
        } catch (JobRecoveryException $jre) {
            LogHelper::log_error("{$log_id}: Job recoverable Exception occured while processing job {$job_id}. Exception is " . $jre);
            LogHelper::log_notice("{$log_id}: Started recovering job to set staus to 0 for job {$job_id}.");
            $job_details = array('status' => 0, 'start_time' => NULL, 'end_time' => NULL);
            $job_log = "~~{$log_id}: Job recovered for job {$job_id} on " . date("m-d-Y, H:i:s") . ". Exception is " . $jre->getMessage();
            QueueUtil::updateJobDetails($job_id, $job_details, $job_log);
            LogHelper::log_notice("{$log_id}: Completed recovering job and updated staus to 0 for job {$job_id} for reprocessing.");
        } catch (Exception $exception) {
            LogHelper::log_error("{$log_id}: Error while processing queue job {$job_id}. Exception is " . $exception);
            LogHelper::log_notice("{$log_id}: Started udpating failed status 3 for job {$job_id}.");
            $job_details = array('status' => 3, 'end_time' => time());
            $job_log = "~~{$log_id}: Error while processing queue job on " . date("m-d-Y, H:i:s") . ". Exception is " . $exception->getMessage();
            QueueUtil::updateJobDetails($job_id, $job_details, $job_log);
            LogHelper::log_notice("{$log_id}: Completed udpating failed status 3 for job {$job_id}.");
        }
    } else {
        LogHelper::log_notice("{$log_id}: No requests are found for processing. Sleep until next job is available.");
    }
} else {
    LogHelper::log_notice("{$log_id}: Currently a job is in progress. Skipping processing next job until current job is finished.");
}
LogHelper::log_notice("{$log_id}: Completed process queue cron.");