From 035fed0875029f34fce0cb522723d6fb0b6b5df9 Mon Sep 17 00:00:00 2001 From: guites Date: Fri, 27 Jun 2025 15:51:57 -0300 Subject: [PATCH 1/2] feat: allow setting curl connect timeout via env variable --- .env | 3 ++- src/Executor/Runner/Docker.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 1d6fd50..bcc3112 100644 --- a/.env +++ b/.env @@ -13,4 +13,5 @@ OPR_EXECUTOR_DOCKER_HUB_USERNAME= OPR_EXECUTOR_DOCKER_HUB_PASSWORD= OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v5 OPR_EXECUTOR_RETRY_ATTEMPTS=5 -OPR_EXECUTOR_RETRY_DELAY_MS=500 \ No newline at end of file +OPR_EXECUTOR_RETRY_DELAY_MS=500 +OPR_EXECUTOR_CONNECT_TIMEOUT= diff --git a/src/Executor/Runner/Docker.php b/src/Executor/Runner/Docker.php index 98e1741..85663cd 100644 --- a/src/Executor/Runner/Docker.php +++ b/src/Executor/Runner/Docker.php @@ -788,7 +788,7 @@ public function createExecution( \curl_setopt($ch, CURLOPT_POST, true); \curl_setopt($ch, CURLOPT_POSTFIELDS, $body); \curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - \curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + \curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)Http::getEnv('OPR_EXECUTOR_CONNECT_TIMEOUT', '10')); \curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', @@ -905,7 +905,7 @@ public function createExecution( \curl_setopt($ch, CURLOPT_POSTFIELDS, $body); \curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); \curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); - \curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); + \curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)Http::getEnv('OPR_EXECUTOR_CONNECT_TIMEOUT', '10')); \curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', @@ -995,7 +995,7 @@ public function createExecution( }); \curl_setopt($ch, CURLOPT_TIMEOUT, $timeout + 5); // Gives extra 5s after safe timeout to recieve response - \curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); + \curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)Http::getEnv('OPR_EXECUTOR_CONNECT_TIMEOUT', '5')); if ($logging === true) { $headers['x-open-runtimes-logging'] = 'enabled'; } else { From cfcdba660fbb1654f2e2d8f0171f189e8d4c5fd0 Mon Sep 17 00:00:00 2001 From: guites Date: Tue, 1 Jul 2025 16:34:06 -0300 Subject: [PATCH 2/2] fix: adds connect timeout var to docker-compose file --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index bc09321..306fb30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,6 +48,7 @@ services: - OPR_EXECUTOR_RETRY_ATTEMPTS - OPR_EXECUTOR_RETRY_DELAY_MS - OPR_EXECUTOR_IMAGE_PULL + - OPR_EXECUTOR_CONNECT_TIMEOUT volumes: openruntimes-builds: