implement delivery queue in case notifier gets killed

This commit is contained in:
Friendika 2011-08-28 21:41:42 -07:00
parent f29f228463
commit 846c4cea7c
8 changed files with 74 additions and 20 deletions

View file

@ -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");