diff options
Diffstat (limited to 'include/queue.php')
-rw-r--r-- | include/queue.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/queue.php b/include/queue.php index f1bcf2e9f..0cb6fcec2 100644 --- a/include/queue.php +++ b/include/queue.php @@ -38,6 +38,20 @@ function queue_run($argv, $argc){ logger('queue: start'); + $interval = intval(get_config('system','delivery_interval')); + if(! $interval) + $interval = 2; + + + $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); + } + } + $r = q("SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue` LEFT JOIN `contact` ON `queue`.`cid` = `contact`.`id` WHERE `queue`.`created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); |