mirror of
https://github.com/friendica/friendica
synced 2024-11-12 23:42:54 +00:00
Merge pull request #14224 from annando/performance
Improve the inbox performance
This commit is contained in:
commit
d7cd450df5
2 changed files with 7 additions and 6 deletions
|
@ -287,6 +287,7 @@ class APContact
|
||||||
} elseif ($apcontact['type'] == 'Tombstone') {
|
} elseif ($apcontact['type'] == 'Tombstone') {
|
||||||
// The "inbox" field must have a content
|
// The "inbox" field must have a content
|
||||||
$apcontact['inbox'] = '';
|
$apcontact['inbox'] = '';
|
||||||
|
$apcontact['addr'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit if this doesn't seem to be an account at all
|
// Quit if this doesn't seem to be an account at all
|
||||||
|
@ -294,7 +295,7 @@ class APContact
|
||||||
return $fetched_contact;
|
return $fetched_contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($apcontact['addr'])) {
|
if (empty($apcontact['addr']) && ($apcontact['type'] != 'Tombstone')) {
|
||||||
try {
|
try {
|
||||||
$apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
|
$apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|
|
@ -277,12 +277,15 @@ class Receiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Post::exists(['uri' => $object_id, 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT]])) {
|
$type = JsonLD::fetchElement($activity, '@type');
|
||||||
|
|
||||||
|
// Several activities are only done on content types, so we can assume "Note" here.
|
||||||
|
if (Post::exists(['uri' => $object_id, 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT]]) || (in_array($type, ['as:Like', 'as:Dislike', 'litepub:EmojiReact', 'as:Announce', 'as:View']))) {
|
||||||
// We just assume "note" since it doesn't make a difference for the further processing
|
// We just assume "note" since it doesn't make a difference for the further processing
|
||||||
return 'as:Note';
|
return 'as:Note';
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = APContact::getByURL($object_id);
|
$profile = APContact::getByURL($object_id, false);
|
||||||
if (!empty($profile['type'])) {
|
if (!empty($profile['type'])) {
|
||||||
APContact::unmarkForArchival($profile);
|
APContact::unmarkForArchival($profile);
|
||||||
return 'as:' . $profile['type'];
|
return 'as:' . $profile['type'];
|
||||||
|
@ -1183,9 +1186,6 @@ class Receiver
|
||||||
$profile = APContact::getByURL($actor);
|
$profile = APContact::getByURL($actor);
|
||||||
$followers = $profile['followers'] ?? '';
|
$followers = $profile['followers'] ?? '';
|
||||||
$isGroup = ($profile['type'] ?? '') == 'Group';
|
$isGroup = ($profile['type'] ?? '') == 'Group';
|
||||||
if ($push) {
|
|
||||||
Contact::updateByUrlIfNeeded($actor);
|
|
||||||
}
|
|
||||||
Logger::info('Got actor and followers', ['actor' => $actor, 'followers' => $followers]);
|
Logger::info('Got actor and followers', ['actor' => $actor, 'followers' => $followers]);
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Empty actor', ['activity' => $activity]);
|
Logger::info('Empty actor', ['activity' => $activity]);
|
||||||
|
|
Loading…
Reference in a new issue