1
1
Fork 0

Merge pull request #7592 from annando/performance

Fix performance issues due to relay contact requests
This commit is contained in:
Hypolite Petovan 2019-09-03 11:28:47 -04:00 committed by GitHub
commit d1af4ea1a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -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;

View file

@ -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;
}