X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fqueue.php;h=7e92705be27db7e639c547b8a6c2a45853aeef96;hb=1872cf2b2d14be5c4b8fbc9e2cf61f9fcd9e2f88;hp=1ac1e7d48c6db3f000847977b6c69f1ef081bc20;hpb=88e6e4699a89a0f17799af44e4a085fe28efeb81;p=friendica.git diff --git a/include/queue.php b/include/queue.php index 1ac1e7d48c..7e92705be2 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); } } @@ -62,13 +61,18 @@ function queue_run($argv, $argc){ q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); } - if($queue_id) + if($queue_id) { $r = q("SELECT `id` FROM `queue` WHERE `id` = %d LIMIT 1", intval($queue_id) ); - else - $r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); + } + else { + // For the first 12 hours we'll try to deliver every 15 minutes + // After that, we'll only attempt delivery once per hour. + + $r = q("SELECT `id` FROM `queue` WHERE (( `created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR && `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ) OR ( `last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR ))"); + } if(! count($r)){ return; } @@ -124,6 +128,7 @@ function queue_run($argv, $argc){ } $data = $qi[0]['content']; + $public = $qi[0]['batch']; $contact = $c[0]; $owner = $u[0]; @@ -156,7 +161,7 @@ function queue_run($argv, $argc){ case NETWORK_DIASPORA: if($contact['notify']) { logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name']); - $deliver_status = diaspora_transmit($owner,$contact,$data); + $deliver_status = diaspora_transmit($owner,$contact,$data,$public); if($deliver_status == (-1)) update_queue_time($q_item['id']);