Skip to content

Commit

Permalink
Fix receiving sigkill after pulling job from stack but before startin…
Browse files Browse the repository at this point in the history
…g forking

Before if we received a sigkill after pulling from stack but before starting the forking process, we would end up handling the sigkill, then resuming the forking process.  The child process would be started, and then hard killed once the parent process was done shutting itself down, resulting in a stranded job.
  • Loading branch information
daneren2005 committed Oct 12, 2021
1 parent a6b88ca commit 0c2b76c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Resque/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
$this->logger->log(Psr\Log\LogLevel::NOTICE, 'Starting work on {job}', array('job' => $job));
Resque_Event::trigger('beforeFork', $job);
$this->workingOn($job);
if($this->shutdown) {
$this->checkForRequeueJob();
break;
}

$this->isForking = true;
$this->child = Resque::fork();
Expand Down

0 comments on commit 0c2b76c

Please sign in to comment.