mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-08 00:04:27 +02:00
Improved asynchronous message procession
This commit is contained in:
parent
c88b1c0197
commit
a1947d2bb1
8 changed files with 46 additions and 38 deletions
|
@ -22,6 +22,7 @@
|
|||
namespace Friendica\Protocol\ActivityPub;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -285,9 +286,25 @@ class Queue
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($entry['object-id']) && !empty($entry['in-reply-to-id']) && ($entry['object-id'] != $entry['in-reply-to-id']) && DBA::exists('inbox-entry', ['object-id' => $entry['in-reply-to-id']])) {
|
||||
// This entry belongs to some other entry that should be processed first
|
||||
return false;
|
||||
if (!empty($entry['object-id']) && !empty($entry['in-reply-to-id']) && ($entry['object-id'] != $entry['in-reply-to-id'])) {
|
||||
if (DBA::exists('inbox-entry', ['object-id' => $entry['in-reply-to-id']])) {
|
||||
// This entry belongs to some other entry that should be processed first
|
||||
return false;
|
||||
}
|
||||
if (!Post::exists(['uri' => $entry['in-reply-to-id']])) {
|
||||
// This entry belongs to some other entry that need to be fetched first
|
||||
if (Fetch::hasWorker($entry['in-reply-to-id'])) {
|
||||
Logger::debug('Fetching of the activity is already queued', ['id' => $entry['activity-id'], 'reply-to-id' => $entry['in-reply-to-id']]);
|
||||
return false;
|
||||
}
|
||||
Fetch::add($entry['in-reply-to-id']);
|
||||
$activity = json_decode($entry['activity'], true);
|
||||
$activity['recursion-depth'] = 0;
|
||||
$wid = Worker::add(Worker::PRIORITY_HIGH, 'FetchMissingActivity', $entry['in-reply-to-id'], $activity, '', Receiver::COMPLETION_ASYNC);
|
||||
Fetch::setWorkerId($entry['in-reply-to-id'], $wid);
|
||||
Logger::debug('Fetch missing activity', ['wid' => $wid, 'id' => $entry['activity-id'], 'reply-to-id' => $entry['in-reply-to-id']]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue