Advertisement
Guest User

Untitled

a guest
May 27th, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1.  
  2. /**
  3. * Registers the shutdown function and the time to process the job
  4. *
  5. * @param array $jobStats
  6. */
  7. protected function registerShutdownFunction(array $jobStats)
  8. {
  9. register_shutdown_function([$this, 'shutdownJob']);
  10. $timeLeft = (int) $jobStats['time-left'] - 10;
  11. $this->getLogger()->info('Time Left to complete job: ' . $timeLeft);
  12. set_time_limit($timeLeft);
  13. }
  14.  
  15. /**
  16. * Tells the processor to shutdown the job
  17. */
  18. public function shutdownJob()
  19. {
  20. $this->getLogger()->warn('Shutting down job');
  21. $this->processor->forceShutDown();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement