Use getmypid() as dependency (improve testing)
This commit is contained in:
parent
7413b362f5
commit
c9e510d4fd
|
@ -67,14 +67,14 @@ class Process
|
||||||
*/
|
*/
|
||||||
private $pid;
|
private $pid;
|
||||||
|
|
||||||
public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, Model\Process $processModel, string $basepath)
|
public function __construct(LoggerInterface $logger, App\Mode $mode, IConfig $config, Model\Process $processModel, string $basepath, int $pid)
|
||||||
{
|
{
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->mode = $mode;
|
$this->mode = $mode;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->basePath = $basepath;
|
$this->basePath = $basepath;
|
||||||
$this->processModel = $processModel;
|
$this->processModel = $processModel;
|
||||||
$this->pid = getmypid();
|
$this->pid = $pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1172,7 +1172,7 @@ class Worker
|
||||||
$args = ['no_cron' => !$do_cron];
|
$args = ['no_cron' => !$do_cron];
|
||||||
|
|
||||||
$a = DI::app();
|
$a = DI::app();
|
||||||
$process = new Core\Process(DI::logger(), DI::mode(), DI::config(), $a->getBasePath());
|
$process = new Core\Process(DI::logger(), DI::mode(), DI::config(), DI::modelProcess(), $a->getBasePath(), getmypid());
|
||||||
$process->run($command, $args);
|
$process->run($command, $args);
|
||||||
|
|
||||||
// after spawning we have to remove the flag.
|
// after spawning we have to remove the flag.
|
||||||
|
|
|
@ -187,6 +187,7 @@ return [
|
||||||
Process::class => [
|
Process::class => [
|
||||||
'constructParams' => [
|
'constructParams' => [
|
||||||
[Dice::INSTANCE => '$basepath'],
|
[Dice::INSTANCE => '$basepath'],
|
||||||
|
getmypid(),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
App\Router::class => [
|
App\Router::class => [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user