Skip to content

Commit

Permalink
Ignore any incoming jobs once the worker is shutting down
Browse files Browse the repository at this point in the history
  • Loading branch information
bzikarsky committed Apr 28, 2021
1 parent 2230ef3 commit d022b90
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ protected function handleUniqueJob(CommandInterface $command): void

protected function processJob(JobInterface $job): void
{
// If we are shutting down, ignore the job, we likely already unregistered the function
if ($this->shutdownPromise !== null) {
return;
}

if (!isset($this->functions[$job->getFunction()])) {
throw new LogicException("Got job for unknown function {$job->getFunction()}");
}
Expand Down

0 comments on commit d022b90

Please sign in to comment.