From d1acdf310f8619d780bc319a9e225ab60f8bca3c Mon Sep 17 00:00:00 2001 From: Laura Folco Date: Tue, 9 May 2017 14:07:44 -0400 Subject: [PATCH] Dispatch events when jobs die or disappear. --- app/code/community/Aoe/Scheduler/Helper/GracefulDead.php | 1 + app/code/community/Aoe/Scheduler/Model/Schedule.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/community/Aoe/Scheduler/Helper/GracefulDead.php b/app/code/community/Aoe/Scheduler/Helper/GracefulDead.php index 7e2105f..aaab282 100644 --- a/app/code/community/Aoe/Scheduler/Helper/GracefulDead.php +++ b/app/code/community/Aoe/Scheduler/Helper/GracefulDead.php @@ -38,6 +38,7 @@ public static function beforeDying($message = null, $exit = false) ->setFinishedAt(strftime('%Y-%m-%d %H:%M:%S', time())) ->save(); Mage::unregister('currently_running_schedule'); + Mage::app()->dispatchEvent('cron_job_died', array('job' => $schedule->getJob(), 'message' => $message)); } if ($exit) { exit; diff --git a/app/code/community/Aoe/Scheduler/Model/Schedule.php b/app/code/community/Aoe/Scheduler/Model/Schedule.php index 9a54e57..5c13bd7 100755 --- a/app/code/community/Aoe/Scheduler/Model/Schedule.php +++ b/app/code/community/Aoe/Scheduler/Model/Schedule.php @@ -431,8 +431,8 @@ public function markAsDisappeared($message = null) ->setStatus(self::STATUS_DISAPPEARED) ->setFinishedAt($this->getLastSeen()) ->save(); - $this->log(sprintf('Job "%s" (id: %s) disappeared. Message: %s', $this->getJobCode(), $this->getId(), $message)); + Mage::app()->dispatchEvent('cron_job_disappeared', array('job' => $this->getJob(), 'message' => $message)); } /**