Set the timeout to 10 seconds

This commit is contained in:
Michael 2022-02-06 10:07:18 +00:00
parent b3da88ceaa
commit 8b585c6ccc

View File

@ -1050,14 +1050,14 @@ class GServer
return $serverdata; return $serverdata;
} }
$retrial = 0; $time = time();
foreach ($contacts as $contact) { foreach ($contacts as $contact) {
$probed = Contact::getByURL($contact, true); $probed = Contact::getByURL($contact, true);
if (!empty($probed) && !$probed['failed'] && in_array($probed['network'], Protocol::FEDERATED)) { if (!empty($probed) && !$probed['failed'] && in_array($probed['network'], Protocol::FEDERATED)) {
$serverdata['network'] = $probed['network']; $serverdata['network'] = $probed['network'];
break; break;
} elseif (++$retrial > 10) { } elseif ((time() - $time) > 10) {
// To reduce the stress on remote systems we probe a maximum of 10 contacts // To reduce the stress on remote systems we probe a maximum of 10 seconds
break; break;
} }
} }