From ed19ae05cb40af4945376ab4550f9216d068537f Mon Sep 17 00:00:00 2001 From: Matthew Spero Date: Thu, 13 Mar 2025 13:24:03 -0500 Subject: [PATCH 1/2] Use --max-time instead of --connect-timeout See https://curl.se/docs/manpage.html - this helps make sure background processes aren't piling up. --- src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php b/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php index 0ea2961e..781ce503 100644 --- a/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php +++ b/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php @@ -80,7 +80,7 @@ private function createCurlArgs(string $payload): string { $scheme = $this->_ssl ? "https://" : "http://"; $args = " -X POST"; - $args.= " --connect-timeout " . $this->_connectTimeout; + $args.= " --max-time " . $this->_connectTimeout; foreach ($this->_eventHeaders as $key => $value) { if ($key == 'Authorization') { From e5d53f1e4dbaa3f7cafa1e915694dc644f42b78f Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Tue, 25 Mar 2025 13:53:05 -0400 Subject: [PATCH 2/2] Support --max-time and --connect-time --- src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php b/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php index 781ce503..c3d530ad 100644 --- a/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php +++ b/src/LaunchDarkly/Impl/Integrations/CurlEventPublisher.php @@ -22,6 +22,7 @@ class CurlEventPublisher implements EventPublisher private bool $_ssl; private string $_curl = '/usr/bin/env curl'; private int $_connectTimeout; + private int $_timeout; private bool $_isWindows; /** @var array */ @@ -51,6 +52,7 @@ public function __construct(string $sdkKey, array $options = []) $this->_eventHeaders = Util::eventHeaders($sdkKey, $options); $this->_connectTimeout = $options['connect_timeout']; + $this->_timeout = $options['timeout']; $this->_isWindows = PHP_OS_FAMILY == 'Windows'; } @@ -80,7 +82,8 @@ private function createCurlArgs(string $payload): string { $scheme = $this->_ssl ? "https://" : "http://"; $args = " -X POST"; - $args.= " --max-time " . $this->_connectTimeout; + $args.= " --connect-timeout " . $this->_connectTimeout; + $args.= " --max-time " . $this->_timeout; foreach ($this->_eventHeaders as $key => $value) { if ($key == 'Authorization') {