Skip to content

Commit 1c969be

Browse files
authored
fix: Honor timeout configuration for CurlEventPublisher (#216)
1 parent 8fc6f4b commit 1c969be

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class CurlEventPublisher implements EventPublisher
2222
private bool $_ssl;
2323
private string $_curl = '/usr/bin/env curl';
2424
private int $_connectTimeout;
25+
private int $_timeout;
2526
private bool $_isWindows;
2627

2728
/** @var array<string, string> */
@@ -51,6 +52,7 @@ public function __construct(string $sdkKey, array $options = [])
5152

5253
$this->_eventHeaders = Util::eventHeaders($sdkKey, $options);
5354
$this->_connectTimeout = $options['connect_timeout'];
55+
$this->_timeout = $options['timeout'];
5456
$this->_isWindows = PHP_OS_FAMILY == 'Windows';
5557
}
5658

@@ -81,6 +83,7 @@ private function createCurlArgs(string $payload): string
8183
$scheme = $this->_ssl ? "https://" : "http://";
8284
$args = " -X POST";
8385
$args.= " --connect-timeout " . $this->_connectTimeout;
86+
$args.= " --max-time " . $this->_timeout;
8487

8588
foreach ($this->_eventHeaders as $key => $value) {
8689
if ($key == 'Authorization') {

0 commit comments

Comments
 (0)