Merge pull request #47948 from nextcloud/fix/issue-34720

fix(collaboration): Reduce timeouts to 3s for link reference connects
This commit is contained in:
Joas Schilling 2024-09-16 11:25:32 +02:00 committed by GitHub
commit 932d488b9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,7 +114,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi
$client = $this->clientService->newClient();
try {
$headResponse = $client->head($reference->getId(), [ 'timeout' => 10 ]);
$headResponse = $client->head($reference->getId(), [ 'timeout' => 3 ]);
} catch (\Exception $e) {
$this->logger->debug('Failed to perform HEAD request to get target metadata', ['exception' => $e]);
return;
@ -136,7 +136,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi
}
try {
$response = $client->get($reference->getId(), [ 'timeout' => 10, 'stream' => true ]);
$response = $client->get($reference->getId(), [ 'timeout' => 3, 'stream' => true ]);
} catch (\Exception $e) {
$this->logger->debug('Failed to fetch link for obtaining open graph data', ['exception' => $e]);
return;
@ -184,7 +184,7 @@ class LinkReferenceProvider implements IReferenceProvider, IPublicReferenceProvi
$folder = $appData->newFolder('opengraph');
}
$response = $client->get($object->images[0]->url, ['timeout' => 10]);
$response = $client->get($object->images[0]->url, ['timeout' => 3]);
$contentType = $response->getHeader('Content-Type');
$contentLength = $response->getHeader('Content-Length');