From 177e0e15d73fedd3c58a9d5f9cb7f509bd1da07b Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 29 Aug 2011 00:59:44 -0700 Subject: [PATCH] allow zero delivery interval on dedicated servers --- include/notifier.php | 10 +++++----- include/queue.php | 7 +++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index aa186317f..1c71538d7 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -384,9 +384,7 @@ function notifier_run($argv, $argc){ require_once('include/salmon.php'); - $interval = intval(get_config('system','delivery_interval')); - if(! $interval) - $interval = 2; + $interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval'))); // delivery loop @@ -411,7 +409,8 @@ function notifier_run($argv, $argc){ if((! $mail) && (! $fsuggest) && (! $followup)) { proc_run('php','include/delivery.php',$cmd,$item_id,$contact['id']); - @time_sleep_until(microtime(true) + (float) $interval); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); } $deliver_status = 0; @@ -661,7 +660,8 @@ function notifier_run($argv, $argc){ if((! $mail) && (! $fsuggest) && (! $followup)) { logger('notifier: delivery agent: ' . $rr['name'] . ' ' . $rr['id']); proc_run('php','include/delivery.php',$cmd,$item_id,$rr['id']); - @time_sleep_until(microtime(true) + (float) $interval); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); } } } diff --git a/include/queue.php b/include/queue.php index 1ac1e7d48..5119a65d8 100644 --- a/include/queue.php +++ b/include/queue.php @@ -38,16 +38,15 @@ function queue_run($argv, $argc){ logger('queue: start'); - $interval = intval(get_config('system','delivery_interval')); - if(! $interval) - $interval = 2; + $interval = ((get_config('system','delivery_interval') === false) ? 2 : intval(get_config('system','delivery_interval'))); $r = q("select * from deliverq where 1"); if(count($r)) { foreach($r as $rr) { logger('queue: deliverq'); proc_run('php','include/delivery.php',$rr['cmd'],$rr['item'],$rr['contact']); - @time_sleep_until(microtime(true) + (float) $interval); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); } }