Only process entries for existing posts

This commit is contained in:
Michael 2022-08-03 05:14:07 +00:00
parent 3463e34693
commit e82ef8890b
2 changed files with 6 additions and 1 deletions

View file

@ -1050,7 +1050,7 @@ class Processor
Queue::remove($activity); Queue::remove($activity);
if ($success && Queue::hasChildren($item['uri'])) { if ($success && Queue::hasChildren($item['uri']) && Post::exists(['uri' => $item['uri']])) {
Queue::processReplyByUri($item['uri']); Queue::processReplyByUri($item['uri']);
} }

View file

@ -25,6 +25,7 @@ use Friendica\Core\Logger;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Post;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\JsonLD; use Friendica\Util\JsonLD;
@ -232,6 +233,10 @@ class Queue
{ {
$entries = DBA::select('inbox-entry', ['id', 'type', 'object-type', 'object-id', 'in-reply-to-id'], ["`trust` AND `wid` IS NULL"], ['order' => ['id' => true]]); $entries = DBA::select('inbox-entry', ['id', 'type', 'object-type', 'object-id', 'in-reply-to-id'], ["`trust` AND `wid` IS NULL"], ['order' => ['id' => true]]);
while ($entry = DBA::fetch($entries)) { while ($entry = DBA::fetch($entries)) {
// Don't process entries of items that are answer to non existing posts
if (!empty($entry['in-reply-to-id']) && !Post::exists(['uri' => $entry['in-reply-to-id']])) {
continue;
}
// We don't need to process entries that depend on already existing entries. // We don't need to process entries that depend on already existing entries.
if (!empty($entry['in-reply-to-id']) && DBA::exists('inbox-entry', ["`id` != ? AND `object-id` = ?", $entry['id'], $entry['in-reply-to-id']])) { if (!empty($entry['in-reply-to-id']) && DBA::exists('inbox-entry', ["`id` != ? AND `object-id` = ?", $entry['id'], $entry['in-reply-to-id']])) {
continue; continue;