From 98f656cfcbaf81c001802dacd593ff9548345014 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 24 Sep 2015 22:51:47 -0700 Subject: delivery optimisations --- include/deliver_hooks.php | 29 +++++++++++++++++++++++++++++ include/notifier.php | 33 +++++++++++++++++++++++++-------- 2 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 include/deliver_hooks.php (limited to 'include') diff --git a/include/deliver_hooks.php b/include/deliver_hooks.php new file mode 100644 index 000000000..f0d6ba1b1 --- /dev/null +++ b/include/deliver_hooks.php @@ -0,0 +1,29 @@ += $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); -- cgit v1.2.3