diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-28 15:25:17 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2021-04-29 10:21:08 +0300 |
commit | c022e923ff19afe18b6af68b01fe8ca07c9891c0 (patch) | |
tree | 3e685fe2862edba8047c1b6deb6859a740a40ffd /apps/lookup_server_connector | |
parent | 4369d1cf1d934b355ce53f025e22807774f64787 (diff) |
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 272d66e9491..fed4aa7fec6 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 |