Merge pull request #11802 from annando/issue-11800

Issue 11800: Remove entry from queue in any case.
This commit is contained in:
Philipp 2022-07-30 10:07:46 +02:00 committed by GitHub
commit da06878f6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,14 +215,13 @@ class Processor
$item['edited'] = DateTimeFormat::utc($activity['updated']); $item['edited'] = DateTimeFormat::utc($activity['updated']);
$item = self::processContent($activity, $item); $item = self::processContent($activity, $item);
self::storeAttachments($activity, $item);
self::storeQuestion($activity, $item);
if (empty($item)) { if (empty($item)) {
return; return;
} }
self::storeAttachments($activity, $item);
self::storeQuestion($activity, $item);
Post\History::add($item['uri-id'], $item); Post\History::add($item['uri-id'], $item);
Item::update($item, ['uri' => $activity['id']]); Item::update($item, ['uri' => $activity['id']]);
@ -300,6 +299,11 @@ class Processor
$conversation = []; $conversation = [];
} }
if (empty($activity['author']) && empty($activity['actor'])) {
Logger::notice('Missing author and actor. We quit here.', ['activity' => $activity]);
return [];
}
if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Post::exists(['uri' => $activity['reply-to-id']])) { if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Post::exists(['uri' => $activity['reply-to-id']])) {
$recursion_depth = $activity['recursion-depth'] ?? 0; $recursion_depth = $activity['recursion-depth'] ?? 0;
Logger::notice('Parent not found. Try to refetch it.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]); Logger::notice('Parent not found. Try to refetch it.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]);
@ -972,9 +976,6 @@ class Processor
$success = true; $success = true;
} else { } else {
Logger::notice('Item insertion aborted', ['uri' => $item['uri'], 'uid' => $item['uid']]); Logger::notice('Item insertion aborted', ['uri' => $item['uri'], 'uid' => $item['uid']]);
if (Item::isTooOld($item) || !Item::isValid($item)) {
Queue::remove($activity);
}
} }
if ($item['uid'] == 0) { if ($item['uid'] == 0) {
@ -982,12 +983,10 @@ class Processor
} }
} }
if ($success) { Queue::remove($activity);
Queue::remove($activity);
if (Queue::hasChildren($item['uri'])) { if ($success && Queue::hasChildren($item['uri'])) {
Worker::add(PRIORITY_HIGH, 'ProcessReplyByUri', $item['uri']); Worker::add(PRIORITY_HIGH, 'ProcessReplyByUri', $item['uri']);
}
} }
// Store send a follow request for every reshare - but only when the item had been stored // Store send a follow request for every reshare - but only when the item had been stored