Increment the "failed" value on failed relay delivery

This commit is contained in:
Michael 2019-09-02 03:37:45 +00:00
parent 6af4c90dff
commit db16f1a106

View file

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