aboutsummaryrefslogtreecommitdiffstats
path: root/include/delivery.php
diff options
context:
space:
mode:
authorzottel <github@zottel.net>2012-05-04 10:00:04 +0200
committerzottel <github@zottel.net>2012-05-04 10:00:04 +0200
commita9f825ec3fc8b44115b1fae3b1aeb2c07f23e3de (patch)
tree8c931e7a9feb65af4505864e605dbccf544bfdec /include/delivery.php
parent35771a778df18afb231969c242680a6353e5ef8e (diff)
parent22c8fe46a554457b43b9721f1f46739511398060 (diff)
downloadvolse-hubzilla-a9f825ec3fc8b44115b1fae3b1aeb2c07f23e3de.tar.gz
volse-hubzilla-a9f825ec3fc8b44115b1fae3b1aeb2c07f23e3de.tar.bz2
volse-hubzilla-a9f825ec3fc8b44115b1fae3b1aeb2c07f23e3de.zip
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/delivery.php')
-rw-r--r--include/delivery.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/delivery.php b/include/delivery.php
index 794b8f27a..28d81226a 100644
--- a/include/delivery.php
+++ b/include/delivery.php
@@ -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",