-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Doorman manager child processing fix.
- Loading branch information
1 parent
817b1f5
commit 57d3abd
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Symbiote\QueuedJobs\Services; | ||
|
||
use AsyncPHP\Doorman\Manager\ProcessManager as BaseProcessManager; | ||
|
||
/** | ||
* Class ProcessManager | ||
* | ||
* customise shell command to allow child tasks to persist even after manager process is terminated | ||
* this lets the started jobs to finish properly in case the management process terminates | ||
* fore example there are no more jobs to start or queue is paused | ||
* | ||
* @package Symbiote\QueuedJobs\Services | ||
*/ | ||
class ProcessManager extends BaseProcessManager | ||
{ | ||
/** | ||
* @param string $binary | ||
* @param string $worker | ||
* @param string $stdout | ||
* @param string $stderr | ||
* @return string | ||
*/ | ||
protected function getCommand($binary, $worker, $stdout, $stderr) // phpcs:ignore SlevomatCodingStandard.TypeHints | ||
{ | ||
return sprintf('nohup %s %s %%s %s %s & echo $!', $binary, $worker, $stdout, $stderr); | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
// Prevent background tasks from being killed when this script finishes | ||
// this is an override for the default behaviour of killing background tasks | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters