mirror of
https://github.com/friendica/friendica
synced 2025-04-26 11:10:11 +00:00
Locking waits now for a shorter period. DB locking is used at other locations as well
This commit is contained in:
parent
8db079c65e
commit
b86c4d539e
4 changed files with 26 additions and 16 deletions
|
@ -1995,10 +1995,11 @@ function get_gcontact_id($contact) {
|
|||
if (in_array($contact["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
|
||||
$contact["url"] = clean_contact_url($contact["url"]);
|
||||
|
||||
$r = q("SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 2",
|
||||
dba::lock('gcontact');
|
||||
$r = q("SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||
dbesc(normalise_link($contact["url"])));
|
||||
|
||||
if ($r) {
|
||||
if (dbm::is_result($r)) {
|
||||
$gcontact_id = $r[0]["id"];
|
||||
|
||||
// Update every 90 days
|
||||
|
@ -2036,17 +2037,13 @@ function get_gcontact_id($contact) {
|
|||
$doprobing = in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""));
|
||||
}
|
||||
}
|
||||
dba::unlock();
|
||||
|
||||
if ($doprobing) {
|
||||
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
|
||||
proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
|
||||
}
|
||||
|
||||
if ((dbm::is_result($r)) AND (count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
|
||||
q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d",
|
||||
dbesc(normalise_link($contact["url"])),
|
||||
intval($gcontact_id));
|
||||
|
||||
return $gcontact_id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue