]> git.mxchange.org Git - friendica.git/commitdiff
Increment the "failed" value on failed relay delivery
authorMichael <heluecht@pirati.ca>
Mon, 2 Sep 2019 03:37:45 +0000 (03:37 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 2 Sep 2019 03:37:45 +0000 (03:37 +0000)
src/Worker/Delivery.php

index 99731544884f7d002cdfc494471f4aae9b009a2b..3079adecc227b98a953718df5e6f81a3d3efa93a 100644 (file)
@@ -318,7 +318,11 @@ class Delivery extends BaseObject
                                Logger::log('Relay delivery to ' . $contact["url"] . ' with guid ' . $target_item["guid"] . ' returns ' . $deliver_status);
 
                                if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
-                                       Model\ItemDeliveryData::incrementQueueDone($target_item['id'], $protocol);
+                                       if (($deliver_status >= 200) && ($deliver_status <= 299)) {
+                                               Model\ItemDeliveryData::incrementQueueDone($target_item['id'], $protocol);
+                                       } else {
+                                               Model\ItemDeliveryData::incrementQueueFailed($target_item['id']);
+                                       }
                                }
                                return;
                        }
@@ -448,10 +452,10 @@ class Delivery extends BaseObject
                                Logger::info('Delivery failed: defer message', ['id' => defaults($target_item, 'guid', $target_item['id'])]);
                                // defer message for redelivery
                                if (!Worker::defer() && in_array($cmd, [Delivery::POST, Delivery::POKE])) {
-                                       Model\ItemDeliveryData::incrementQueueFailed($target_item['id'], Model\ItemDeliveryData::DIASPORA);
+                                       Model\ItemDeliveryData::incrementQueueFailed($target_item['id']);
                                }
                        } elseif (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
-                               Model\ItemDeliveryData::incrementQueueDone($target_item['id'], Model\ItemDeliveryData::DIASPORA);
+                               Model\ItemDeliveryData::incrementQueueFailed($target_item['id']);
                        }
                }
        }