diff options
Diffstat (limited to 'Zotlabs/Lib/Queue.php')
-rw-r--r-- | Zotlabs/Lib/Queue.php | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Zotlabs/Lib/Queue.php b/Zotlabs/Lib/Queue.php index c3f9cda20..23691408a 100644 --- a/Zotlabs/Lib/Queue.php +++ b/Zotlabs/Lib/Queue.php @@ -65,16 +65,32 @@ class Queue { ); } - - static function remove($id,$channel_id = 0) { - logger('queue: remove queue item ' . $id,LOGGER_DEBUG); + public static function remove($id, $channel_id = 0) { + logger('queue: remove queue item ' . $id, LOGGER_DEBUG); $sql_extra = (($channel_id) ? " and outq_channel = " . intval($channel_id) . " " : ''); - q("DELETE FROM outq WHERE outq_hash = '%s' $sql_extra", + // figure out what endpoint it is going to. + $record = q("select outq_posturl from outq where outq_hash = '%s' $sql_extra", dbesc($id) ); - } + if ($record) { + q("DELETE FROM outq WHERE outq_hash = '%s' $sql_extra", + dbesc($id) + ); + + // If there's anything remaining in the queue for this site, move one of them to the next active + // queue run by setting outq_scheduled back to the present. We may be attempting to deliver it + // as a 'piled_up' delivery, but this ensures the site has an active queue entry as long as queued + // entries still exist for it. This fixes an issue where one immediate delivery left everything + // else for that site undeliverable since all the other entries had been pushed far into the future. + + q("update outq set outq_scheduled = '%s' where outq_posturl = '%s' limit 1", + dbesc(datetime_convert()), + dbesc($record[0]['outq_posturl']) + ); + } + } static function remove_by_posturl($posturl) { logger('queue: remove queue posturl ' . $posturl,LOGGER_DEBUG); @@ -84,8 +100,6 @@ class Queue { ); } - - static function set_delivered($id,$channel = 0) { logger('queue: set delivered ' . $id,LOGGER_DEBUG); $sql_extra = (($channel['channel_id']) ? " and outq_channel = " . intval($channel['channel_id']) . " " : ''); |