diff options
author | zottel <github@zottel.net> | 2012-05-22 08:46:02 +0200 |
---|---|---|
committer | zottel <github@zottel.net> | 2012-05-22 08:46:02 +0200 |
commit | e9c86c0fd0fb87b49e60669e6d4be810ca426ec4 (patch) | |
tree | cfee80cc9122974a4304591aa7d54ca5fc8a71ea /include/notifier.php | |
parent | 2cd3ec7b983327f8c162845d0f4b8d9753f30e27 (diff) | |
parent | 02502c3a7460a1af3414b65232fd7c672a76d941 (diff) | |
download | volse-hubzilla-e9c86c0fd0fb87b49e60669e6d4be810ca426ec4.tar.gz volse-hubzilla-e9c86c0fd0fb87b49e60669e6d4be810ca426ec4.tar.bz2 volse-hubzilla-e9c86c0fd0fb87b49e60669e6d4be810ca426ec4.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/notifier.php')
-rw-r--r-- | include/notifier.php | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/include/notifier.php b/include/notifier.php index 8b904dbcd..cb4fb2a31 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -478,24 +478,42 @@ function notifier_run($argv, $argc){ } } + + // This controls the number of deliveries to execute with each separate delivery process. + // By default we'll perform one delivery per process. Assuming a hostile shared hosting + // provider, this provides the greatest chance of deliveries if processes start getting + // killed. We can also space them out with the delivery_interval to also help avoid them + // getting whacked. + + // If $deliveries_per_process > 1, we will chain this number of multiple deliveries + // together into a single process. This will reduce the overall number of processes + // spawned for each delivery, but they will run longer. + $deliveries_per_process = intval(get_config('system','delivery_batch_count')); if($deliveries_per_process <= 0) $deliveries_per_process = 1; $this_batch = array(); - foreach($r as $contact) { + for($x = 0; $x < count($r); $x ++) { + $contact = $r[$x]; + if($contact['self']) continue; // potentially more than one recipient. Start a new process and space them out a bit. - // we will deliver single recipient types of message and email receipients here. - + // we will deliver single recipient types of message and email recipients here. + if((! $mail) && (! $fsuggest) && (! $followup)) { - // deliveries per process not yet implemented, 1 delivery per process. - proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']); - if($interval) - @time_sleep_until(microtime(true) + (float) $interval); + + $this_batch[] = $contact['id']; + + if(count($this_batch) == $deliveries_per_process) { + proc_run('php','include/delivery.php',$cmd,$item_id,$this_batch); + $this_batch = array(); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); + } continue; } |