set extension browser timeout to minimum of 10 seconds.
authorJon Goldberg <jon@megaphonetech.com>
Wed, 25 Oct 2023 18:09:14 +0000 (14:09 -0400)
committerJon Goldberg <jon@megaphonetech.com>
Fri, 1 Dec 2023 00:59:22 +0000 (19:59 -0500)
CRM/Extension/Browser.php

index 5b7b683fd716fb7e01490fc664869fb63de18bc8..cf6dcae9d354087caf07dd0ded54146d86f6aacd 100644 (file)
@@ -34,11 +34,6 @@ class CRM_Extension_Browser {
    */
   const SINGLE_FILE_PATH = '/single';
 
-  /**
-   * Timeout for when the connection or the server is slow
-   */
-  const CHECK_TIMEOUT = 5;
-
   /**
    * @var GuzzleHttp\Client
    */
@@ -219,9 +214,11 @@ class CRM_Extension_Browser {
 
     $url = $this->getRepositoryUrl() . $this->indexPath;
     $client = $this->getGuzzleClient();
+    // Timeout should be a minimum of 10 seconds. See https://lab.civicrm.org/infra/ops/-/issues/1009.
+    $timeout = max(10, \Civi::settings()->get('http_timeout'));
     try {
       $response = $client->request('GET', $url, [
-        'timeout' => \Civi::settings()->get('http_timeout'),
+        'timeout' => $timeout,
       ]);
     }
     catch (GuzzleException $e) {