From 08cd651a035ab13db68386c558d7bdba8c4726d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 21 Jul 2021 15:12:30 +0000 Subject: [PATCH] Improved performance for UpdateContacts --- src/Worker/UpdateContacts.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Worker/UpdateContacts.php b/src/Worker/UpdateContacts.php index ba4f9db41c..0c211aa939 100644 --- a/src/Worker/UpdateContacts.php +++ b/src/Worker/UpdateContacts.php @@ -55,9 +55,11 @@ class UpdateContacts $ids = self::getContactsToUpdate($condition, [], $limit); Logger::info('Fetched federated user contacts', ['count' => count($ids)]); - $conditions = ["`id` IN (SELECT `author-id` FROM `post-user`)", "`id` IN (SELECT `owner-id` FROM `post-user`)", - "`id` IN (SELECT `causer-id` FROM `post-user`)", "`id` IN (SELECT `cid` FROM `post-tag`)", - "`id` IN (SELECT `cid` FROM `user-contact`)"]; + $conditions = ["`id` IN (SELECT `author-id` FROM `post-user` WHERE `author-id` = `contact`.`id`)", + "`id` IN (SELECT `owner-id` FROM `post-user` WHERE `owner-id` = `contact`.`id`)", + "`id` IN (SELECT `causer-id` FROM `post-user` WHERE `causer-id` = `contact`.`id`)", + "`id` IN (SELECT `cid` FROM `post-tag` WHERE `cid` = `contact`.`id`)", + "`id` IN (SELECT `cid` FROM `user-contact` WHERE `cid` = `contact`.`id`)"]; foreach ($conditions as $contact_condition) { $condition = DBA::mergeConditions($base_condition,