diff options
author | M. Dent <dentm42@gmail.com> | 2018-10-16 21:19:16 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-10-16 21:19:16 +0200 |
commit | f50d6208c8225410f1cd3bf2e1842ffa1a7d3f4e (patch) | |
tree | 016264e536dc4d45f7f6ba6cfe0c0b5e43e90142 | |
parent | 34d189c02ea394cdd9b1ad164b90c40413764e57 (diff) | |
download | volse-hubzilla-f50d6208c8225410f1cd3bf2e1842ffa1a7d3f4e.tar.gz volse-hubzilla-f50d6208c8225410f1cd3bf2e1842ffa1a7d3f4e.tar.bz2 volse-hubzilla-f50d6208c8225410f1cd3bf2e1842ffa1a7d3f4e.zip |
Fix master rate limiter
-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); |