aboutsummaryrefslogtreecommitdiffstats
path: root/apps/federation/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2024-04-10 21:45:33 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-04-11 09:52:46 +0000
commitf064883f4eb84820964e7f46c15d7d5c22931b8e (patch)
tree9d8382e719b6207c77e8b1080b4efe3130778c01 /apps/federation/lib
parent57f885939eef3f11462b4746fa6fa3adf97e25e4 (diff)
downloadnextcloud-server-f064883f4eb84820964e7f46c15d7d5c22931b8e.tar.gz
nextcloud-server-f064883f4eb84820964e7f46c15d7d5c22931b8e.zip
fix(federation): give some time to prepare both servers
- when this background job runs, while the current server was not being added as trusted_server in the other instance, yet, the secret sharing would not be attempted again, without visual feedback. - the change allows 5 attempts, which gives more than 20minutes to complete. More do not really help as the endpoint is brute force protected. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/federation/lib')
-rw-r--r--apps/federation/lib/BackgroundJob/RequestSharedSecret.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
index 98eb81000f2..f8c25168b56 100644
--- a/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
+++ b/apps/federation/lib/BackgroundJob/RequestSharedSecret.php
@@ -160,7 +160,7 @@ class RequestSharedSecret extends Job {
// if we received a unexpected response we try again later
if (
$status !== Http::STATUS_OK
- && $status !== Http::STATUS_FORBIDDEN
+ && ($status !== Http::STATUS_FORBIDDEN || $this->getAttempt($argument) < 5)
) {
$this->retainJob = true;
}
@@ -173,14 +173,20 @@ class RequestSharedSecret extends Job {
$url = $argument['url'];
$created = isset($argument['created']) ? (int)$argument['created'] : $this->time->getTime();
$token = $argument['token'];
+ $attempt = $this->getAttempt($argument) + 1;
$this->jobList->add(
RequestSharedSecret::class,
[
'url' => $url,
'token' => $token,
- 'created' => $created
+ 'created' => $created,
+ 'attempt' => $attempt
]
);
}
+
+ protected function getAttempt(array $argument): int {
+ return $argument['attempt'] ?? 0;
+ }
}