Merge pull request #8472 from annando/prevent-loop
Discover contacts: Prevent putting much stress on remote systems
This commit is contained in:
commit
352383f7b2
2 changed files with 4 additions and 3 deletions
|
@ -1359,7 +1359,7 @@ class GContact
|
||||||
|
|
||||||
if (!Network::isUrlBlocked($contact)) {
|
if (!Network::isUrlBlocked($contact)) {
|
||||||
Logger::info('Discover new AP contact', ['url' => $contact]);
|
Logger::info('Discover new AP contact', ['url' => $contact]);
|
||||||
Worker::add(PRIORITY_LOW, 'UpdateGContact', $contact);
|
Worker::add(PRIORITY_LOW, 'UpdateGContact', $contact, 'nodiscover');
|
||||||
} else {
|
} else {
|
||||||
Logger::info('No discovery, the URL is blocked.', ['url' => $contact]);
|
Logger::info('No discovery, the URL is blocked.', ['url' => $contact]);
|
||||||
}
|
}
|
||||||
|
@ -1399,7 +1399,7 @@ class GContact
|
||||||
}
|
}
|
||||||
if (!Network::isUrlBlocked($entry['value'])) {
|
if (!Network::isUrlBlocked($entry['value'])) {
|
||||||
Logger::info('Discover new PoCo contact', ['url' => $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 {
|
} else {
|
||||||
Logger::info('No discovery, the URL is blocked.', ['url' => $entry['value']]);
|
Logger::info('No discovery, the URL is blocked.', ['url' => $entry['value']]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,12 +35,13 @@ class UpdateGContact
|
||||||
public static function execute(string $url, string $command = '')
|
public static function execute(string $url, string $command = '')
|
||||||
{
|
{
|
||||||
$force = ($command == "force");
|
$force = ($command == "force");
|
||||||
|
$nodiscover = ($command == "nodiscover");
|
||||||
|
|
||||||
$success = GContact::updateFromProbe($url, $force);
|
$success = GContact::updateFromProbe($url, $force);
|
||||||
|
|
||||||
Logger::info('Updated from probe', ['url' => $url, 'force' => $force, 'success' => $success]);
|
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);
|
GContact::discoverFollowers($url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue