Skip to content

Commit

Permalink
Improve some logging if we fail to remove working status
Browse files Browse the repository at this point in the history
  • Loading branch information
daneren2005 committed Oct 28, 2021
1 parent 30857ad commit b79a14a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/Resque/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ public function perform()
$instance->tearDown();
}

Resque::redis()->lrem('working:' . $this->queue, 0, $this->payload['id']);
$removed = Resque::redis()->lrem('working:' . $this->queue, 0, $this->payload['id']);
if($removed <= 0) {
$this->worker->logger->log(Psr\Log\LogLevel::EMERGENCY, $this->payload['id'] . ' was not removed from working:' . $this->queue);
}
Resque_Event::trigger('afterPerform', $this);
}
// beforePerform/setUp have said don't perform this job. Return.
Expand Down
4 changes: 2 additions & 2 deletions lib/Resque/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
} else {
if (in_array($job->getStatus(), array(Resque_Job_Status::STATUS_RUNNING))) {
$job->updateStatus(Resque_Job_Status::STATUS_COMPLETE);
$this->logger->log(Psr\Log\LogLevel::INFO, 'done' . $job);
$this->logger->log(Psr\Log\LogLevel::INFO, 'Updating job status as done for ' . $job);
}
}
}
Expand All @@ -271,7 +271,7 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
$this->child = null;
$this->doneWorking();

$this->logger->log(Psr\Log\LogLevel::INFO, 'Done workering on child {child} for {worker}', Array(
$this->logger->log(Psr\Log\LogLevel::INFO, 'Done working on child {child} for {worker}', Array(
'child' => $child,
'worker' => $this
));
Expand Down

0 comments on commit b79a14a

Please sign in to comment.