Skip to content

Commit 7b163f0

Browse files
Add timeout for management dashboard API calls (#14)
Those API calls should be pretty fast, and this is often in a performance-critical path, so adding aggressive timeouts. This should hopefully prevent the search and queue services from timing out at the PHP level, and dying while holding the cache lock and deadlocking the entire PHP-FPM server. Users of the API client can always adjust this value if a call is expected to be slow.
1 parent 131c2c1 commit 7b163f0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Clients/DashboardHttpClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function __construct(string $orchBaseUrl, string $secret, ?string $forced
2828
parent::__construct($orchBaseUrl);
2929
$this->setDefaultHeader("content-type", "application/json");
3030
$this->setThrowExceptions(true);
31+
$this->setDefaultOption(HttpRequest::OPT_TIMEOUT, 10);
32+
$this->setDefaultOption(HttpRequest::OPT_CONNECT_TIMEOUT, 5);
3133

3234
if ($forcedHostname !== null) {
3335
HttpUtils::forceForceHostname($this, $forcedHostname);

0 commit comments

Comments
 (0)