X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FUpdateServerPeers.php;h=aa5f35c0fc612df5a1a3ecbd4067e2cfd94c3623;hb=40a126306621fe9eadb58101bd19a0be32e4c163;hp=98ae88a97b5be8acded06a0dc1a0f040ecfc4a10;hpb=e299fc67c8809ecf1018e6680a3a5284bcf7d8d9;p=friendica.git diff --git a/src/Worker/UpdateServerPeers.php b/src/Worker/UpdateServerPeers.php index 98ae88a97b..aa5f35c0fc 100644 --- a/src/Worker/UpdateServerPeers.php +++ b/src/Worker/UpdateServerPeers.php @@ -1,6 +1,6 @@ get('system', 'poco_discovery')) { + return; + } + $ret = DI::httpClient()->get($url . '/api/v1/instance/peers', HttpClientAccept::JSON); if (!$ret->isSuccess() || empty($ret->getBody())) { Logger::info('Server is not reachable or does not offer the "peers" endpoint', ['url' => $url]); @@ -53,6 +61,11 @@ class UpdateServerPeers $total = 0; $added = 0; foreach ($peers as $peer) { + if (Network::isUrlBlocked('https://' . $peer)) { + // Ignore blocked systems as soon as possible in the loop to avoid being slowed down by tar pits + continue; + } + ++$total; if (DBA::exists('gserver', ['nurl' => Strings::normaliseLink('http://' . $peer)])) { // We already know this server @@ -61,6 +74,7 @@ class UpdateServerPeers // This endpoint doesn't offer the schema. So we assume that it is HTTPS. GServer::add('https://' . $peer); ++$added; + Worker::coolDown(); } Logger::info('Server peer update ended', ['total' => $total, 'added' => $added, 'url' => $url]); }