]> git.mxchange.org Git - friendica.git/commitdiff
Failed post deliveries are now deleted via cron
authorMichael <heluecht@pirati.ca>
Fri, 13 May 2022 18:48:13 +0000 (18:48 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 13 May 2022 18:48:13 +0000 (18:48 +0000)
src/Model/Post/Delivery.php
src/Worker/APDelivery.php
src/Worker/RequeuePosts.php

index 52c1bf8e0ee979c9d29c3f0fd9af65dcd8dd2906..f8ed068fe8e128f089f75c04fc172933ae43cdf7 100644 (file)
@@ -83,7 +83,7 @@ class Delivery
 
        public static function selectForInbox(string $inbox)
        {
-               $rows = DBA::select('post-delivery', [], ['inbox-id' => ItemURI::getIdByURI($inbox)], ['order' => ['created']]);
+               $rows = DBA::select('post-delivery', [], ["`inbox-id` = ? AND `failed` < ?", ItemURI::getIdByURI($inbox), DI::config()->get('system', 'worker_defer_limit')], ['order' => ['created']]);
                $deliveries = [];
                while ($row = DBA::fetch($rows)) {
                        if (!empty($row['receivers'])) {
index 6995b0edf117333b0cbaf15697e2369032e9814e..df9df8128a4fefb736fc3c0f8d1852c430d291b9 100644 (file)
@@ -86,8 +86,6 @@ class APDelivery
 
        private static function deliver(string $inbox)
        {
-               Post\Delivery::removeFailed($inbox);
-               
                $uri_ids = [];
                $posts   = Post\Delivery::selectForInbox($inbox);
 
index 600a0d40b382e4a36f25823518310f42f70ce6c4..3c3d249bb647bce173086a9119dba481d1f15aae 100644 (file)
@@ -24,6 +24,7 @@ namespace Friendica\Worker;
 use Friendica\Core\Logger;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\Model\Post;
 
 /**
  * Requeue posts that are stuck in the post-delivery table without a matching delivery job.
@@ -35,6 +36,8 @@ class RequeuePosts
        {
                $deliveries = DBA::p("SELECT `item-uri`.`uri` AS `inbox` FROM `post-delivery` INNER JOIN `item-uri` ON `item-uri`.`id` = `post-delivery`.`inbox-id` GROUP BY `inbox`");
                while ($delivery = DBA::fetch($deliveries)) {
+                       Post\Delivery::removeFailed($delivery['inbox']);
+               
                        if (Worker::add(PRIORITY_HIGH, 'APDelivery', '', 0, $delivery['inbox'], 0)) {
                                Logger::info('Missing APDelivery worker added for inbox', ['inbox' => $delivery['inbox']]);
                        }