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/core
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-12-15 06:49:39 +0300
committerGitHub <noreply@github.com>2020-12-15 06:49:39 +0300
commit8c73d9273fd981a87bd27a20a883bc9a2d49f012 (patch)
tree7cb2e3eee498ea2ee81e914200cea508e9e26ee2 /core
parentcaec48a374d9de8a1505d5b8997fea8bfc72745c (diff)
Avoid filesystem checks when process was set as finished (#16954)
Because in CliMulti we might check in a loop for every process constantly if they are finished. It won't help all that much but better to not check every time the file system when it is not needed. There be many other things we could improve there. Will add some comments but probably best not to do them (or we'll see if it's needed later)
Diffstat (limited to 'core')
-rw-r--r--core/CliMulti/Process.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/CliMulti/Process.php b/core/CliMulti/Process.php
index daed5a85c4..bb0583c4ad 100644
--- a/core/CliMulti/Process.php
+++ b/core/CliMulti/Process.php
@@ -21,6 +21,7 @@ use Piwik\SettingsServer;
*/
class Process
{
+ private $finished = null;
private $pidFile = '';
private $timeCreation = null;
private $isSupported = null;
@@ -81,6 +82,10 @@ class Process
public function hasFinished()
{
+ if ($this->finished) {
+ return true;
+ }
+
$content = $this->getPidFileContent();
return !$this->doesPidFileExist($content);
@@ -129,6 +134,7 @@ class Process
public function finishProcess()
{
+ $this->finished = true;
Filesystem::deleteFileIfExists($this->pidFile);
}