From b1ce613aa1560550317a963e1c73348d5e11e5d4 Mon Sep 17 00:00:00 2001 From: Mojmir Fendek Date: Fri, 15 Jan 2021 11:38:36 +1300 Subject: [PATCH] BUG: Doorman manager child processing fix. (#305) * BUG: Doorman manager child processing fix. * PR fixes * Configurable behaviour (PR fixes). --- composer.json | 2 +- src/Services/ProcessManager.php | 67 +++++++++++++++++++++++++++++ src/Tasks/Engines/DoormanRunner.php | 2 +- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/Services/ProcessManager.php diff --git a/composer.json b/composer.json index c1270d7c..4a08e518 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "php": "^7.1", "silverstripe/framework": "^4.7", "silverstripe/admin": "^1", - "asyncphp/doorman": "^3.0" + "asyncphp/doorman": "^3.1" }, "require-dev": { "sminnee/phpunit": "^5.7", diff --git a/src/Services/ProcessManager.php b/src/Services/ProcessManager.php new file mode 100644 index 00000000..cd3e8a4f --- /dev/null +++ b/src/Services/ProcessManager.php @@ -0,0 +1,67 @@ +config()->get('persistent_child_process')) { + // Prevent background tasks from being killed when this script finishes + // this is an override for the default behaviour of killing background tasks + return; + } + + parent::__destruct(); + } +} diff --git a/src/Tasks/Engines/DoormanRunner.php b/src/Tasks/Engines/DoormanRunner.php index 502620ab..63459792 100644 --- a/src/Tasks/Engines/DoormanRunner.php +++ b/src/Tasks/Engines/DoormanRunner.php @@ -2,12 +2,12 @@ namespace Symbiote\QueuedJobs\Tasks\Engines; -use AsyncPHP\Doorman\Manager\ProcessManager; use SilverStripe\Core\Environment; use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\FieldType\DBDatetime; use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor; use Symbiote\QueuedJobs\Jobs\DoormanQueuedJobTask; +use Symbiote\QueuedJobs\Services\ProcessManager; use Symbiote\QueuedJobs\Services\QueuedJob; use Symbiote\QueuedJobs\Services\QueuedJobService;