diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-28 14:25:17 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-28 14:27:46 +0200 |
commit | 758a662b2355162810c8d6d561bee27c43c6bbaa (patch) | |
tree | f98406e79dc27b39b7be26799ae34872f4e0247e /apps/lookup_server_connector | |
parent | 48f05158e5ad61e9d68f00edf765b0f70a6db074 (diff) | |
download | nextcloud-server-758a662b2355162810c8d6d561bee27c43c6bbaa.tar.gz nextcloud-server-758a662b2355162810c8d6d561bee27c43c6bbaa.zip |
Do not try to contact lookup server if not needed
In some cases (for example you never send data to the lookup server)
there is no need for this job to even try.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r-- | apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php index c462eeedb43..da0721dc017 100644 --- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php +++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php @@ -152,7 +152,14 @@ class RetryJob extends Job { try { if (count($data) === 1) { - // No public data, just the federation Id + $dataOnLookupServer = $this->config->getUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '0') === '1'; + + if (!$dataOnLookupServer) { + // We never send data to the lookupserver so no need to delete it + return; + } + + // There is data on the lookup server so we must delete it $client->delete($this->lookupServer, [ 'body' => json_encode($signedData), @@ -160,6 +167,8 @@ class RetryJob extends Job { 'connect_timeout' => 3, ] ); + + $this->config->setUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '0'); } else { $client->post($this->lookupServer, [ @@ -168,6 +177,7 @@ class RetryJob extends Job { 'connect_timeout' => 3, ] ); + $this->config->setUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '1'); } // Reset retry counter |