]> git.mxchange.org Git - friendica.git/commitdiff
queue optimisation - back off delivery attempts to once per hour after the first...
authorfriendica <info@friendica.com>
Sat, 17 Mar 2012 10:43:02 +0000 (03:43 -0700)
committerfriendica <info@friendica.com>
Sat, 17 Mar 2012 10:43:02 +0000 (03:43 -0700)
include/queue.php

index d312b50f5a99fe778feee4563f4252098ca813cc..7e92705be27db7e639c547b8a6c2a45853aeef96 100755 (executable)
@@ -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;
        }