aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-02-12 10:41:23 +0000
committerMario <mario@mariovavti.com>2023-02-12 10:41:23 +0000
commit724b8cc6a54c2e778a2d67b2177ecf373f615c64 (patch)
tree4ce3f360cced4fc5e0a41ecfce425b9c68f4e2ac /Zotlabs/Lib
parent2bfd18e6cdf229f39cd4c0bd191c874c0e75d5f0 (diff)
downloadvolse-hubzilla-724b8cc6a54c2e778a2d67b2177ecf373f615c64.tar.gz
volse-hubzilla-724b8cc6a54c2e778a2d67b2177ecf373f615c64.tar.bz2
volse-hubzilla-724b8cc6a54c2e778a2d67b2177ecf373f615c64.zip
port queue improvements from streams
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Queue.php28
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']) . " " : '');