From 3e763ac81e895d2b4af18af2bcd7a31e25da4cf6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 15 Jun 2016 16:30:24 +0200 Subject: Add timeouts to make the UI usable again when a remote share is unreachable --- apps/federatedfilesharing/lib/DiscoveryManager.php | 5 ++++- apps/federatedfilesharing/lib/Notifications.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/federatedfilesharing') diff --git a/apps/federatedfilesharing/lib/DiscoveryManager.php b/apps/federatedfilesharing/lib/DiscoveryManager.php index 2a4bb4b7f77..bf8dfeb31dc 100644 --- a/apps/federatedfilesharing/lib/DiscoveryManager.php +++ b/apps/federatedfilesharing/lib/DiscoveryManager.php @@ -84,7 +84,10 @@ class DiscoveryManager { // Read the data from the response body try { - $response = $this->client->get($remote . '/ocs-provider/'); + $response = $this->client->get($remote . '/ocs-provider/', [ + 'timeout' => 3, + 'connect_timeout' => 3, + ]); if($response->getStatusCode() === 200) { $decodedService = json_decode($response->getBody(), true); if(is_array($decodedService)) { diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 18212b82c3e..575521d564d 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -287,7 +287,9 @@ class Notifications { $endpoint = $this->discoveryManager->getShareEndpoint($protocol . $remoteDomain); try { $response = $client->post($protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [ - 'body' => $fields + 'body' => $fields, + 'timeout' => 3, + 'connect_timeout' => 3, ]); $result['result'] = $response->getBody(); $result['success'] = true; -- cgit v1.2.3