Merge branch 'fix-master-rate-limiter' into 'dev'
Fix master rate limiter See merge request hubzilla/core!1341
This commit is contained in:
		| @@ -54,7 +54,9 @@ class Master { | |||||||
| 		if (count($workers) > $maxworkers) { | 		if (count($workers) > $maxworkers) { | ||||||
| 			foreach ($workers as $idx => $worker) { | 			foreach ($workers as $idx => $worker) { | ||||||
|                                 $curtime = time(); |                                 $curtime = time(); | ||||||
| 				if (($time - $worker['v']) > $workermaxage) { |                                 $age = (intval($curtime) - intval($worker['v'])); | ||||||
|  |                                 if ( $age > $workermaxage) { | ||||||
|  | 					logger("Prune worker: ".$worker['k'], LOGGER_ALL, LOGGER_DEBUG); | ||||||
| 					$k = explode('_',$worker['k']); | 					$k = explode('_',$worker['k']); | ||||||
| 					q("delete from config where cat='queueworkers' and k='%s'", | 					q("delete from config where cat='queueworkers' and k='%s'", | ||||||
| 						'workerstarted_'.$k[1]); | 						'workerstarted_'.$k[1]); | ||||||
| @@ -100,6 +102,11 @@ class Master { | |||||||
| 				$argc = $workinfo['argc']; | 				$argc = $workinfo['argc']; | ||||||
| 				$argv = $workinfo['argv']; | 				$argv = $workinfo['argv']; | ||||||
| 				logger('Master: process: ' . print_r($argv,true), LOGGER_ALL,LOG_DEBUG); | 				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 = '\\Zotlabs\\Daemon\\' . $argv[0]; | ||||||
| 				$cls::run($argc,$argv); | 				$cls::run($argc,$argv); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user