mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
implement max load average before queuing/deferring delivery and poller processes
This commit is contained in:
parent
15542a8690
commit
421acee65b
4 changed files with 28 additions and 1 deletions
|
@ -51,6 +51,17 @@ function delivery_run($argv, $argc){
|
|||
return;
|
||||
}
|
||||
|
||||
$maxsysload = intval(get_config('system','maxloadavg'));
|
||||
if($maxsysload < 1)
|
||||
$maxsysload = 50;
|
||||
if(function_exists('sys_getloadavg')) {
|
||||
$load = sys_getloadavg();
|
||||
if(intval($load[0]) > $maxsysload) {
|
||||
logger('system: load ' . $load . ' too high. Delivery deferred to next queue run.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// It's ours to deliver. Remove it from the queue.
|
||||
|
||||
q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue