aboutsummaryrefslogtreecommitdiffstats
path: root/include/queue.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-28 21:41:42 -0700
committerFriendika <info@friendika.com>2011-08-28 21:41:42 -0700
commit846c4cea7c0e3868a63a187ee9a504a031b2a7e4 (patch)
tree034407e183dfb95ce9ef77cbe6a5af73377e2090 /include/queue.php
parentf29f228463d35f574d6d285be0cf337b7d39c541 (diff)
downloadvolse-hubzilla-846c4cea7c0e3868a63a187ee9a504a031b2a7e4.tar.gz
volse-hubzilla-846c4cea7c0e3868a63a187ee9a504a031b2a7e4.tar.bz2
volse-hubzilla-846c4cea7c0e3868a63a187ee9a504a031b2a7e4.zip
implement delivery queue in case notifier gets killed
Diffstat (limited to 'include/queue.php')
-rw-r--r--include/queue.php14
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");