diff options
author | Andrew Manning <tamanning@zoho.com> | 2017-01-29 19:53:41 -0500 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2017-01-29 19:53:41 -0500 |
commit | f8918604087af97a9e416ba2a8503920f8b08186 (patch) | |
tree | 1332a4686c05f9a659f0b3aeb6acc51948921720 /Zotlabs/Daemon/Queue.php | |
parent | 3424c7dc878ecf5b1f1c021737e3d7eba2443299 (diff) | |
parent | dbf7ff979122ea0f8877e9ae4b16590f280593ef (diff) | |
download | volse-hubzilla-f8918604087af97a9e416ba2a8503920f8b08186.tar.gz volse-hubzilla-f8918604087af97a9e416ba2a8503920f8b08186.tar.bz2 volse-hubzilla-f8918604087af97a9e416ba2a8503920f8b08186.zip |
Merge remote-tracking branch 'upstream/dev' into affinity-settings
Diffstat (limited to 'Zotlabs/Daemon/Queue.php')
-rw-r--r-- | Zotlabs/Daemon/Queue.php | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php index 27306589d..11cbe4494 100644 --- a/Zotlabs/Daemon/Queue.php +++ b/Zotlabs/Daemon/Queue.php @@ -61,30 +61,15 @@ class Queue { // the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once // or twice a day. - // FIXME: can we sort postgres on outq_priority and maintain the 'distinct' ? - // The order by max(outq_priority) might be a dodgy query because of the group by. - // The desired result is to return a sequence in the order most likely to be delivered in this run. - // If a hub has already been sitting in the queue for a few days, they should be delivered last; - // hence every failure should drop them further down the priority list. - - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $prefix = 'DISTINCT ON (outq_posturl)'; - $suffix = 'ORDER BY outq_posturl'; - } else { - $prefix = ''; - $suffix = 'GROUP BY outq_posturl ORDER BY max(outq_priority)'; - } - $r = q("SELECT $prefix * FROM outq WHERE outq_delivered = 0 and (( outq_created > %s - INTERVAL %s and outq_updated < %s - INTERVAL %s ) OR ( outq_updated < %s - INTERVAL %s )) $suffix", - db_utcnow(), db_quoteinterval('12 HOUR'), - db_utcnow(), db_quoteinterval('15 MINUTE'), - db_utcnow(), db_quoteinterval('1 HOUR') + $r = q("SELECT * FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s ", + db_utcnow() ); } if(! $r) return; - foreach($r as $rr) { - queue_deliver($rr); + foreach($r as $rv) { + queue_deliver($rv); } } } |