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'])) {
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.
{
$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']]);
}