Issue 9968: Avoid blocking update calls
This commit is contained in:
parent
aa6472061b
commit
d78345e694
3 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2021.03-rc (Red Hot Poker)
|
-- Friendica 2021.03-rc (Red Hot Poker)
|
||||||
-- DB_UPDATE_VERSION 1408
|
-- DB_UPDATE_VERSION 1409
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,6 +186,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
||||||
INDEX `blocked_uid` (`blocked`,`uid`),
|
INDEX `blocked_uid` (`blocked`,`uid`),
|
||||||
INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
|
INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
|
||||||
INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
|
INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
|
||||||
|
INDEX `batch_contact-type` (`batch`(64),`contact-type`),
|
||||||
INDEX `addr_uid` (`addr`(128),`uid`),
|
INDEX `addr_uid` (`addr`(128),`uid`),
|
||||||
INDEX `nurl_uid` (`nurl`(128),`uid`),
|
INDEX `nurl_uid` (`nurl`(128),`uid`),
|
||||||
INDEX `nick_uid` (`nick`(128),`uid`),
|
INDEX `nick_uid` (`nick`(128),`uid`),
|
||||||
|
|
|
@ -855,8 +855,10 @@ class Contact
|
||||||
if (!empty($contact['batch']) && !empty($contact['term-date']) && ($contact['term-date'] > DBA::NULL_DATETIME)) {
|
if (!empty($contact['batch']) && !empty($contact['term-date']) && ($contact['term-date'] > DBA::NULL_DATETIME)) {
|
||||||
$fields = ['failed' => false, 'term-date' => DBA::NULL_DATETIME, 'archive' => false];
|
$fields = ['failed' => false, 'term-date' => DBA::NULL_DATETIME, 'archive' => false];
|
||||||
$condition = ['uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY];
|
$condition = ['uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY];
|
||||||
|
if (!DBA::exists('contact', array_merge($condition, $fields))) {
|
||||||
DBA::update('contact', $fields, $condition);
|
DBA::update('contact', $fields, $condition);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], DBA::NULL_DATETIME];
|
$condition = ['`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], DBA::NULL_DATETIME];
|
||||||
$exists = DBA::exists('contact', $condition);
|
$exists = DBA::exists('contact', $condition);
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1408);
|
define('DB_UPDATE_VERSION', 1409);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -245,6 +245,7 @@ return [
|
||||||
"blocked_uid" => ["blocked", "uid"],
|
"blocked_uid" => ["blocked", "uid"],
|
||||||
"uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
|
"uid_rel_network_poll" => ["uid", "rel", "network", "poll(64)", "archive"],
|
||||||
"uid_network_batch" => ["uid", "network", "batch(64)"],
|
"uid_network_batch" => ["uid", "network", "batch(64)"],
|
||||||
|
"batch_contact-type" => ["batch(64)", "contact-type"],
|
||||||
"addr_uid" => ["addr(128)", "uid"],
|
"addr_uid" => ["addr(128)", "uid"],
|
||||||
"nurl_uid" => ["nurl(128)", "uid"],
|
"nurl_uid" => ["nurl(128)", "uid"],
|
||||||
"nick_uid" => ["nick(128)", "uid"],
|
"nick_uid" => ["nick(128)", "uid"],
|
||||||
|
|
Loading…
Reference in a new issue