]> git.mxchange.org Git - friendica.git/commitdiff
workaround for stalling worker processes when running the daemon
authorMichael <heluecht@pirati.ca>
Wed, 11 Jul 2018 06:05:22 +0000 (06:05 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 11 Jul 2018 06:05:22 +0000 (06:05 +0000)
bin/daemon.php
bin/worker.php
src/Core/Worker.php
src/Model/GContact.php

index f7dcce1642800ba74730f6b05f0f19a805f2b562..1abb70146207e9c1d53b99756244068b055adb5f 100755 (executable)
@@ -106,8 +106,10 @@ if (!$foreground) {
        }
 
        fclose(STDIN);  // Close all of the standard
-       fclose(STDOUT); // file descriptors as we
-       fclose(STDERR); // are running as a daemon.
+
+       // Enabling this seem to block a running php process with 100% CPU usage when there is an outpout
+       // fclose(STDOUT); // file descriptors as we
+       // fclose(STDERR); // are running as a daemon.
 
        dba::disconnect();
 
index b4b265283ccba3d60ea44a38ffc9b6d48c0a92e0..44980961cf0d64aab87d4d155abcfcbb8d33fefe 100755 (executable)
@@ -63,4 +63,3 @@ Worker::unclaimProcess();
 Worker::endProcess();
 
 killme();
-
index 296d40b5046e182ba86cb219f8384f272f170314..5f19870897e81c61429313aa91159bc2b49ec4fa 100644 (file)
@@ -597,7 +597,7 @@ class Worker
                                                ['id' => $entry["id"]]
                                        );
                                } else {
-                                       logger("Worker process ".$entry["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
+                                       logger("Worker process ".$entry["pid"]." (".substr(json_encode($argv), 0, 50).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
                                }
                        }
                }
index 99660ba60283ff80a78cd138c0ba0d63e315e659..d77e81a4c78d819390ecfc402e72f55bb548a286 100644 (file)
@@ -564,15 +564,16 @@ class GContact
 
                if (strlen(Config::get('system', 'directory'))) {
                        $x = Network::fetchUrl(get_server()."/pubsites");
-                       if ($x) {
+                       if (!empty($x)) {
                                $j = json_decode($x);
-                               if ($j->entries) {
+                               if (!empty($j->entries)) {
                                        foreach ($j->entries as $entry) {
                                                PortableContact::checkServer($entry->url);
 
                                                $url = $entry->url . '/poco';
-                                               if (! in_array($url, $done)) {
-                                                       PortableContact::loadWorker(0, 0, 0, $entry->url . '/poco');
+                                               if (!in_array($url, $done)) {
+                                                       PortableContact::loadWorker(0, 0, 0, $url);
+                                                       $done[] = $url;
                                                }
                                        }
                                }