]> git.mxchange.org Git - friendica.git/commitdiff
We found the handbrake ...
authorMichael <heluecht@pirati.ca>
Mon, 5 Jun 2017 22:41:33 +0000 (22:41 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 5 Jun 2017 22:41:33 +0000 (22:41 +0000)
include/poller.php
src/Util/Lock.php

index 2cf1a15f6b38d156c9411caf81b2fdf719e17516..4bd1ee9e4af7fcff5800d34997ad3239ba72292d 100644 (file)
@@ -89,21 +89,16 @@ function poller_run($argv, $argc){
                        continue;
                }
 
-               // To avoid the quitting of multiple pollers we serialize the next check
-               if (!Lock::set('poller_worker')) {
-                       logger('Cannot get a lock, retrying.', LOGGER_DEBUG);
-                       poller_unclaim_process();
-                       continue;
-               }
-
-               // Count active workers and compare them with a maximum value that depends on the load
-               if (poller_too_much_workers()) {
-                       logger('Active worker limit reached, quitting.', LOGGER_DEBUG);
-                       return;
+               // To avoid the quitting of multiple pollers only one poller at a time will execute the check
+               if (Lock::set('poller_worker', 0)) {
+                       // Count active workers and compare them with a maximum value that depends on the load
+                       if (poller_too_much_workers()) {
+                               logger('Active worker limit reached, quitting.', LOGGER_DEBUG);
+                               return;
+                       }
+                       Lock::remove('poller_worker');
                }
 
-               Lock::remove('poller_worker');
-
                // Check free memory
                if ($a->min_memory_reached()) {
                        logger('Memory limit reached, quitting.', LOGGER_DEBUG);
index 7cc3472e69049a3bcdd9e750b29014aca2c6f9d9..63f9b5f9730b63f36134764b10cfcec83cb7f52b 100644 (file)
@@ -79,7 +79,7 @@ class Lock {
                                if (!$got_lock) {
                                        usleep($wait_sec * 1000000);
                                }
-                       } while (!$got_lock AND ((time(true) - $start) < $timeout));
+                       } while (!$got_lock AND ((time() - $start) < $timeout));
 
                        return $got_lock;
                }