Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Registers the shutdown function and the time to process the job
- *
- * @param array $jobStats
- */
- protected function registerShutdownFunction(array $jobStats)
- {
- register_shutdown_function([$this, 'shutdownJob']);
- $timeLeft = (int) $jobStats['time-left'] - 10;
- $this->getLogger()->info('Time Left to complete job: ' . $timeLeft);
- set_time_limit($timeLeft);
- }
- /**
- * Tells the processor to shutdown the job
- */
- public function shutdownJob()
- {
- $this->getLogger()->warn('Shutting down job');
- $this->processor->forceShutDown();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement