diff options
author | Mario <mario@mariovavti.com> | 2018-10-16 19:19:16 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-10-16 21:19:28 +0200 |
commit | 84d40361178af961dc93aa0c53bb49cbfe31da3f (patch) | |
tree | 5555a204c873a4ad1fb12d7b76a5a3fabb26758a | |
parent | ba9b49bc835a35ae139b665a02e2c38d11f427fc (diff) | |
download | volse-hubzilla-84d40361178af961dc93aa0c53bb49cbfe31da3f.tar.gz volse-hubzilla-84d40361178af961dc93aa0c53bb49cbfe31da3f.tar.bz2 volse-hubzilla-84d40361178af961dc93aa0c53bb49cbfe31da3f.zip |
Merge branch 'fix-master-rate-limiter' into 'dev'
Fix master rate limiter
See merge request hubzilla/core!1341
(cherry picked from commit e38e85572e148e1cf684810f6435001b32d8c7fc)
49eff772 Fix worker age calculation
be30dc9e Move logger to debug/all
b6a9be88 Delete duplicate queue items
-rw-r--r-- | Zotlabs/Daemon/Master.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Zotlabs/Daemon/Master.php b/Zotlabs/Daemon/Master.php index ed1adf8fb..3a71ee578 100644 --- a/Zotlabs/Daemon/Master.php +++ b/Zotlabs/Daemon/Master.php @@ -53,8 +53,10 @@ class Master { if (count($workers) > $maxworkers) { foreach ($workers as $idx => $worker) { - $curtime = time(); - if (($time - $worker['v']) > $workermaxage) { + $curtime = time(); + $age = (intval($curtime) - intval($worker['v'])); + if ( $age > $workermaxage) { + logger("Prune worker: ".$worker['k'], LOGGER_ALL, LOGGER_DEBUG); $k = explode('_',$worker['k']); q("delete from config where cat='queueworkers' and k='%s'", 'workerstarted_'.$k[1]); @@ -100,6 +102,11 @@ class Master { $argc = $workinfo['argc']; $argv = $workinfo['argv']; logger('Master: process: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); + + //Delete unclaimed duplicate workitems. + q("delete from config where cat='queuework' and k='workitem' and v='%s'", + serialize($argv)); + $cls = '\\Zotlabs\\Daemon\\' . $argv[0]; $cls::run($argc,$argv); |