Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-12-15 06:51:45 +0300
committerGitHub <noreply@github.com>2020-12-15 06:51:45 +0300
commitd83cd29e93d4adeaad1b844007168be3bebe0222 (patch)
tree2f0eb08415f01dda0d6b7a75be7c2f0a97559677 /tests
parent797817e42f5f4124b3d01efb412126eb39ce4e8c (diff)
Remember if process ever started (#16950)
* Remember if process ever started This can potentially bring a performance improvement as I think sometimes the system would wait for 8 seconds before declaring a process as finished even if it finished after 1s. What happens is in https://github.com/matomo-org/matomo/blob/4.0.5/core/CliMulti.php#L217-L222 it checks if the process has started by checking if the PID file exists. However, the `RequestCommand` deletes the PID file as soon as the process finished to signal "it finished". That means when we check in that loop whether the process has started, it would think it hasn't started yet and simply continue until 8s have past and then it would set the process as finished. Vs we can simply remember that once we say once "the process has started" flag then we can always remember this. I would assume this race condition would happen constantly unless I'm not seeing it right. * fix test
Diffstat (limited to 'tests')
-rw-r--r--tests/PHPUnit/Integration/CliMulti/ProcessTest.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/PHPUnit/Integration/CliMulti/ProcessTest.php b/tests/PHPUnit/Integration/CliMulti/ProcessTest.php
index 383733de53..229a687587 100644
--- a/tests/PHPUnit/Integration/CliMulti/ProcessTest.php
+++ b/tests/PHPUnit/Integration/CliMulti/ProcessTest.php
@@ -121,11 +121,20 @@ class ProcessTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($this->process->hasFinished());
}
- public function test_hasStarted()
+ public function test_hasStarted_startedWhenContentFalse()
{
$this->assertTrue($this->process->hasStarted(false));
+ }
+
+ public function test_hasStarted_startedWhenPidGiven()
+ {
$this->assertTrue($this->process->hasStarted('6341'));
+ // remembers the process was started at some point
+ $this->assertTrue($this->process->hasStarted(''));
+ }
+ public function test_hasStarted_notStartedYetEmptyContentInPid()
+ {
$this->assertFalse($this->process->hasStarted(''));
}