Update the last query at a single place

This commit is contained in:
Michael 2020-08-01 08:56:07 +00:00
parent bb70258d48
commit a9a9f7d51d
2 changed files with 5 additions and 11 deletions

View file

@ -1607,11 +1607,12 @@ class GServer
Logger::info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]); Logger::info('Update peer list', ['server' => $gserver['url'], 'id' => $gserver['id']]);
Worker::add(PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']); Worker::add(PRIORITY_LOW, 'UpdateServerPeers', $gserver['url']);
if ($gserver['directory-type'] == self::DT_POCO) { Logger::info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]);
Logger::info('Update directory', ['server' => $gserver['url'], 'id' => $gserver['id']]); Worker::add(PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
Worker::add(PRIORITY_LOW, 'UpdateServerDirectory', $gserver);
}
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
DBA::update('gserver', $fields, ['nurl' => $gserver['nurl']]);
if (--$no_of_queries == 0) { if (--$no_of_queries == 0) {
break; break;
} }

View file

@ -330,18 +330,11 @@ class PortableContact
} }
} }
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
return true; return true;
} else { } else {
// If the server hadn't replied correctly, then force a sanity check // If the server hadn't replied correctly, then force a sanity check
GServer::check($server["url"], $server["network"], true); GServer::check($server["url"], $server["network"], true);
// If we couldn't reach the server, we will try it some time later
$fields = ['last_poco_query' => DateTimeFormat::utcNow()];
DBA::update('gserver', $fields, ['nurl' => $server["nurl"]]);
return false; return false;
} }
} }