Fix slow queries

This commit is contained in:
Michael 2021-03-01 22:19:47 +00:00
parent 0277c55c43
commit 5f48d6497e
6 changed files with 47 additions and 17 deletions

View file

@ -1959,7 +1959,7 @@ class Contact
}
// If Probe::uri fails the network code will be different ("feed" or "unkn")
if (in_array($ret['network'], [Protocol::FEED, Protocol::PHANTOM]) && ($ret['network'] != $contact['network'])) {
if (($ret['network'] == Protocol::PHANTOM) || (($ret['network'] == Protocol::FEED) && ($ret['network'] != $contact['network']))) {
self::updateContact($id, $uid, $contact['url'], $ret['url'], ['failed' => true, 'last-update' => $updated, 'failure_update' => $updated]);
return false;
}

View file

@ -970,6 +970,10 @@ class Item
unset($item['event-id']);
}
if (empty($item['causer-id'])) {
unset($item['causer-id']);
}
Post::insert($item['uri-id'], $item);
if ($item['gravity'] == GRAVITY_PARENT) {

View file

@ -285,7 +285,7 @@ class Post
$condition = DBA::mergeConditions($condition,
["`visible` AND NOT `deleted`
AND NOT `author-blocked` AND NOT `owner-blocked`
AND (NOT `causer-blocked` OR `causer-id` = ?) AND NOT `contact-blocked`
AND (NOT `causer-blocked` OR `causer-id` = ? OR `causer-id` IS NULL) AND NOT `contact-blocked`
AND ((NOT `contact-readonly` AND NOT `contact-pending` AND (`contact-rel` IN (?, ?)))
OR `self` OR `gravity` != ? OR `contact-uid` = ?)
AND NOT EXISTS (SELECT `uri-id` FROM `post-user` WHERE `hidden` AND `uri-id` = `" . $view . "`.`uri-id` AND `uid` = ?)