aboutsummaryrefslogtreecommitdiffstats
path: root/include/queue.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-03-17 03:43:02 -0700
committerfriendica <info@friendica.com>2012-03-17 03:43:02 -0700
commit94fac6d76725042fc176aaebd2af721ab1540ff7 (patch)
treea02f5b8f3220dd9df43e158c1833c9176d5fcd14 /include/queue.php
parent26258bca77aa3385dacf36874f7f5603eaef9a6b (diff)
downloadvolse-hubzilla-94fac6d76725042fc176aaebd2af721ab1540ff7.tar.gz
volse-hubzilla-94fac6d76725042fc176aaebd2af721ab1540ff7.tar.bz2
volse-hubzilla-94fac6d76725042fc176aaebd2af721ab1540ff7.zip
queue optimisation - back off delivery attempts to once per hour after the first 12 hours.
Diffstat (limited to 'include/queue.php')
-rwxr-xr-xinclude/queue.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/queue.php b/include/queue.php
index d312b50f5..7e92705be 100755
--- a/include/queue.php
+++ b/include/queue.php
@@ -61,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;
}