aboutsummaryrefslogtreecommitdiffstats
path: root/include/notifier.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-24 22:51:47 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-24 22:51:47 -0700
commit98f656cfcbaf81c001802dacd593ff9548345014 (patch)
tree96b8c7a565cde9691b2936b31a728644918ea33b /include/notifier.php
parente558ddae3f0e9cae8800caf878a07f5530d2e31f (diff)
downloadvolse-hubzilla-98f656cfcbaf81c001802dacd593ff9548345014.tar.gz
volse-hubzilla-98f656cfcbaf81c001802dacd593ff9548345014.tar.bz2
volse-hubzilla-98f656cfcbaf81c001802dacd593ff9548345014.zip
delivery optimisations
Diffstat (limited to 'include/notifier.php')
-rw-r--r--include/notifier.php33
1 files changed, 25 insertions, 8 deletions
diff --git a/include/notifier.php b/include/notifier.php
index fd95d53e2..4ce0c7c9f 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -579,7 +579,7 @@ function notifier_run($argv, $argc){
if($deliveries_per_process <= 0)
$deliveries_per_process = 1;
- $deliver = array();
+ $deliveries = array();
foreach($dhubs as $hub) {
@@ -675,7 +675,7 @@ function notifier_run($argv, $argc){
);
}
}
- $deliver[] = $hash;
+ $deliveries[] = $hash;
if(count($deliver) >= $deliveries_per_process) {
proc_run('php','include/deliver.php',$deliver);
@@ -684,18 +684,35 @@ function notifier_run($argv, $argc){
@time_sleep_until(microtime(true) + (float) $interval);
}
}
+
+ if($normal_mode) {
+ $x = q("select * from hook where hook = 'notifier_normal'");
+ if($x)
+ proc_run('php','deliver_hooks.php', $target_item['id']);
+ }
+
+ if($deliveries) {
+ $deliver = array();
+
+ foreach($deliveries as $d) {
+
+ $deliver[] = $d;
+
+ if(count($deliver) >= $deliveries_per_process) {
+ proc_run('php','include/deliver.php',$deliver);
+ $deliver = array();
+ if($interval)
+ @time_sleep_until(microtime(true) + (float) $interval);
+ }
+ }
+ }
// catch any stragglers
- if(count($deliver)) {
+ if($deliver)
proc_run('php','include/deliver.php',$deliver);
- }
logger('notifier: basic loop complete.', LOGGER_DEBUG);
-
- if($normal_mode)
- call_hooks('notifier_normal',$target_item);
-
call_hooks('notifier_end',$target_item);