From: Michael Vogel Date: Mon, 2 Sep 2019 13:11:07 +0000 (+0200) Subject: Fix performance issues due to relay contact requests X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=046b5a1eacfe3cf5e79d75ba749a58d05284a39d;p=friendica.git Fix performance issues due to relay contact requests --- diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 4bdaa9c713..ffdee6aa0e 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -906,7 +906,7 @@ class Contact extends BaseObject // Always unarchive the relay contact entry if (!empty($contact['batch']) && !empty($contact['term-date']) && ($contact['term-date'] > DBA::NULL_DATETIME)) { $fields = ['term-date' => DBA::NULL_DATETIME, 'archive' => false]; - $condition = ['batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY, 'uid' => 0]; + $condition = ['uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY]; DBA::update('contact', $fields, $condition); } @@ -1620,7 +1620,8 @@ class Contact extends BaseObject // Check status of Diaspora endpoints if (!empty($contact['batch'])) { - return DBA::exists('contact', ['archive' => true, 'batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY, 'uid' => 0]); + $condition = ['archive' => true, 'uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY]; + return DBA::exists('contact', $condition); } return false; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index a0bb0d9fa3..2ff271ee0d 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -62,7 +62,8 @@ class Diaspora $relay_contact = $contact; } elseif (empty($contact['baseurl'])) { if (!empty($contact['batch'])) { - $relay_contact = DBA::selectFirst('contact', [], ['batch' => $contact['batch'], 'contact-type' => Contact::TYPE_RELAY, 'uid' => 0]); + $condition = ['uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => Contact::TYPE_RELAY]; + $relay_contact = DBA::selectFirst('contact', [], $condition); } else { return; }