Skip to content

Commit

Permalink
Update worker
Browse files Browse the repository at this point in the history
  • Loading branch information
twomiao committed Oct 12, 2023
1 parent d9e2be0 commit b7c9d55
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -1822,15 +1822,11 @@ protected static function reload(): void
foreach (static::$pidMap as $workerId => $workerPidArray) {
$worker = static::$workers[$workerId];
if ($worker->reloadable) {
foreach ($workerPidArray as $pid) {
$reloadablePidArray[$pid] = $pid;
}
} else {
foreach ($workerPidArray as $pid) {
// Send reload signal to a worker process which reloadable is false.
posix_kill($pid, $sig);
}
$reloadablePidArray += $workerPidArray;
continue;
}
// Send reload signal to a worker process which reloadable is false.
array_walk($workerPidArray, static fn($pid) => posix_kill($pid, $sig));
}
// Get all pids that are waiting reload.
static::$pidsToRestart = array_intersect(static::$pidsToRestart, $reloadablePidArray);
Expand Down

0 comments on commit b7c9d55

Please sign in to comment.