Browse Source

Use getmypid() as dependency (improve testing)

tags/2020.09-1
Philipp 1 month ago
parent
commit
c9e510d4fd
No known key found for this signature in database GPG Key ID: 9A28B7D4FF5667BD
3 changed files with 4 additions and 3 deletions
  1. +2
    -2
      src/Core/Process.php
  2. +1
    -1
      src/Core/Worker.php
  3. +1
    -0
      static/dependencies.config.php

+ 2
- 2
src/Core/Process.php View File

@@ -67,14 +67,14 @@ class Process
*/
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->mode = $mode;
$this->config = $config;
$this->basePath = $basepath;
$this->processModel = $processModel;
$this->pid = getmypid();
$this->pid = $pid;
}

/**


+ 1
- 1
src/Core/Worker.php View File

@@ -1172,7 +1172,7 @@ class Worker
$args = ['no_cron' => !$do_cron];

$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);

// after spawning we have to remove the flag.


+ 1
- 0
static/dependencies.config.php View File

@@ -187,6 +187,7 @@ return [
Process::class => [
'constructParams' => [
[Dice::INSTANCE => '$basepath'],
getmypid(),
],
],
App\Router::class => [


Loading…
Cancel
Save