From f0ceb736d14c16229373820b12155574a6e5d775 Mon Sep 17 00:00:00 2001 From: Netkas Date: Fri, 16 Jun 2023 01:47:59 -0400 Subject: [PATCH] Minor correction --- src/TamerLib/Classes/JobManager.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/TamerLib/Classes/JobManager.php b/src/TamerLib/Classes/JobManager.php index b981330..6592778 100644 --- a/src/TamerLib/Classes/JobManager.php +++ b/src/TamerLib/Classes/JobManager.php @@ -605,7 +605,7 @@ return; } - Log::debug(Utilities::getName(), sprintf('Returning job %s (Return Channel: %s)', $job_id, $return_channel ?? 'n/a')); + Log::debug(Utilities::getName(), sprintf('Returning job %s (Return Channel: %s)', $job_id, $return_channel)); $this->getClient()->hSet($job_id, 'return_value', serialize($return_value)); $this->getClient()->hSet($job_id, 'status', JobStatus::FINISHED); $this->getClient()->rPush($this->getClient()->hGet($job_id, 'return_channel'), $job_id); @@ -643,21 +643,22 @@ try { - if($this->getClient()->exists($job_id)) + if(!$this->getClient()->exists($job_id)) { - if($this->getClient()->hGet($job_id, 'return_channel') === null) - { - $this->getClient()->del($job_id); - return; - } + throw new JobNotFoundException(sprintf('Job %s does not exist on %s:%s', $job_id, $this->server_configuration->getHost(), $this->server_configuration->getPort())); + } - Log::debug(Utilities::getName(), sprintf('Returning exception for job %s', $job_id)); - $this->getClient()->hSet($job_id, 'exception', serialize($throwable)); - $this->getClient()->hSet($job_id, 'status', JobStatus::FAILED); - $this->getClient()->rPush($this->getClient()->hGet($job_id, 'return_channel'), $job_id); - Log::debug(Utilities::getName(), sprintf('Pushed job %s to return channel %s', $job_id, $this->getClient()->hGet($job_id, 'return_channel'))); + if($this->getClient()->hGet($job_id, 'return_channel') === null) + { + $this->getClient()->del($job_id); return; } + + Log::debug(Utilities::getName(), sprintf('Returning exception for job %s', $job_id)); + $this->getClient()->hSet($job_id, 'exception', serialize($throwable)); + $this->getClient()->hSet($job_id, 'status', JobStatus::FAILED); + $this->getClient()->rPush($this->getClient()->hGet($job_id, 'return_channel'), $job_id); + Log::debug(Utilities::getName(), sprintf('Pushed job %s to return channel %s', $job_id, $this->getClient()->hGet($job_id, 'return_channel'))); } catch(RedisException $e) {