Skip to content

Commit

Permalink
Merge pull request #11 from utopia-php/fix-reset-resources
Browse files Browse the repository at this point in the history
Fix: Reset resources after job
  • Loading branch information
christyjacob4 authored Nov 16, 2022
2 parents ddaa241 + 4b36b07 commit 4b39e1f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Queue/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public static function setResource(string $name, callable $callback, array $inje
public function shutdown(): Hook
{
$hook = new Hook();
$hook->groups(['*']);
$this->shutdownHooks[] = $hook;
return $hook;
}
Expand Down Expand Up @@ -174,6 +175,7 @@ public function stop(): self
public function init(): Hook
{
$hook = new Hook();
$hook->groups(['*']);
$this->initHooks[] = $hook;
return $hook;
}
Expand Down Expand Up @@ -298,6 +300,8 @@ public function start(): self
*/
$this->adapter->connection->decrement("{$this->adapter->namespace}.stats.{$this->adapter->queue}.processing");
}

$this->resources = [];
}
});

Expand All @@ -318,6 +322,7 @@ public function start(): self
public function workerStart(): Hook
{
$hook = new Hook();
$hook->groups(['*']);
$this->workerStartHook = $hook;
return $hook;
}
Expand Down Expand Up @@ -413,6 +418,7 @@ protected function validate(string $key, array $param, mixed $value): void
public function error(): Hook
{
$hook = new Hook();
$hook->groups(['*']);
$this->errorHooks[] = $hook;
return $hook;
}
Expand Down

0 comments on commit 4b39e1f

Please sign in to comment.