]> git.mxchange.org Git - friendica.git/commitdiff
Prevent putting much stress on remote systems
authorMichael <heluecht@pirati.ca>
Mon, 30 Mar 2020 06:22:32 +0000 (06:22 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 30 Mar 2020 06:22:32 +0000 (06:22 +0000)
src/Model/GContact.php
src/Worker/UpdateGContact.php

index bf9aa2cf20950287c9b703a95dfde7cabb6dfca4..553976296f997297eb0b91d7f9a6f23e7c47a56a 100644 (file)
@@ -1359,7 +1359,7 @@ class GContact
 
                                if (!Network::isUrlBlocked($contact)) {
                                        Logger::info('Discover new AP contact', ['url' => $contact]);
-                                       Worker::add(PRIORITY_LOW, 'UpdateGContact', $contact);
+                                       Worker::add(PRIORITY_LOW, 'UpdateGContact', $contact, 'nodiscover');
                                } else {
                                        Logger::info('No discovery, the URL is blocked.', ['url' => $contact]);
                                }
@@ -1399,7 +1399,7 @@ class GContact
                                                }
                                                if (!Network::isUrlBlocked($entry['value'])) {
                                                        Logger::info('Discover new PoCo contact', ['url' => $entry['value']]);
-                                                       Worker::add(PRIORITY_LOW, 'UpdateGContact', $entry['value']);
+                                                       Worker::add(PRIORITY_LOW, 'UpdateGContact', $entry['value'], 'nodiscover');
                                                } else {
                                                        Logger::info('No discovery, the URL is blocked.', ['url' => $entry['value']]);
                                                }
index e06356ad46b7bdbfd7918a6fc5ac6706f4b38c30..94e4d07d7b7c91370b8842f1217a407bc0188151 100644 (file)
@@ -35,12 +35,13 @@ class UpdateGContact
        public static function execute(string $url, string $command = '')
        {
                $force = ($command == "force");
+               $nodiscover = ($command == "nodiscover");
 
                $success = GContact::updateFromProbe($url, $force);
 
                Logger::info('Updated from probe', ['url' => $url, 'force' => $force, 'success' => $success]);
 
-               if ($success && (DI::config()->get('system', 'gcontact_discovery') == GContact::DISCOVERY_RECURSIVE)) {
+               if ($success && !$nodiscover && (DI::config()->get('system', 'gcontact_discovery') == GContact::DISCOVERY_RECURSIVE)) {
                        GContact::discoverFollowers($url);
                }
        }