Avoid loops when fetching replies

This commit is contained in:
Michael 2024-07-02 21:36:32 +00:00
parent d6b9858143
commit b739bddd26
2 changed files with 4 additions and 3 deletions

View file

@ -515,7 +515,7 @@ class Processor
} }
} }
if (DI::config()->get('system', 'decoupled_receiver')) { if (DI::config()->get('system', 'decoupled_receiver') && ($activity['completion-mode'] ?? Receiver::COMPLETION_NONE != Receiver::COMPLETION_REPLIES)) {
$replies = [$item['thr-parent']]; $replies = [$item['thr-parent']];
if (!empty($item['parent-uri'])) { if (!empty($item['parent-uri'])) {
$replies[] = $item['parent-uri']; $replies[] = $item['parent-uri'];
@ -1780,7 +1780,7 @@ class Processor
} }
if (parse_url($id, PHP_URL_HOST) == parse_url($url, PHP_URL_HOST)) { if (parse_url($id, PHP_URL_HOST) == parse_url($url, PHP_URL_HOST)) {
Logger::debug('Incluced activity will be processed', ['replies' => $url, 'id' => $id]); Logger::debug('Incluced activity will be processed', ['replies' => $url, 'id' => $id]);
self::processActivity($reply, $id, $child, '', Receiver::COMPLETION_AUTO); self::processActivity($reply, $id, $child, '', Receiver::COMPLETION_REPLIES);
++$fetched; ++$fetched;
continue; continue;
} }
@ -1795,7 +1795,7 @@ class Processor
Logger::debug('Activity is already queued', ['replies' => $url, 'id' => $id]); Logger::debug('Activity is already queued', ['replies' => $url, 'id' => $id]);
} else { } else {
Logger::debug('Missing Activity will be fetched and processed', ['replies' => $url, 'id' => $id]); Logger::debug('Missing Activity will be fetched and processed', ['replies' => $url, 'id' => $id]);
self::fetchMissingActivity($id, $child, '', Receiver::COMPLETION_AUTO); self::fetchMissingActivity($id, $child, '', Receiver::COMPLETION_REPLIES);
++$fetched; ++$fetched;
} }
} }

View file

@ -81,6 +81,7 @@ class Receiver
const COMPLETION_MANUAL = 3; const COMPLETION_MANUAL = 3;
const COMPLETION_AUTO = 4; const COMPLETION_AUTO = 4;
const COMPLETION_ASYNC = 5; const COMPLETION_ASYNC = 5;
const COMPLETION_REPLIES = 6;
/** /**
* Checks incoming message from the inbox * Checks incoming message from the inbox