Skip to content

Commit 035fed0

Browse files
committed
feat: allow setting curl connect timeout via env variable
1 parent 8c19c56 commit 035fed0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ OPR_EXECUTOR_DOCKER_HUB_USERNAME=
1313
OPR_EXECUTOR_DOCKER_HUB_PASSWORD=
1414
OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v5
1515
OPR_EXECUTOR_RETRY_ATTEMPTS=5
16-
OPR_EXECUTOR_RETRY_DELAY_MS=500
16+
OPR_EXECUTOR_RETRY_DELAY_MS=500
17+
OPR_EXECUTOR_CONNECT_TIMEOUT=

src/Executor/Runner/Docker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ public function createExecution(
788788
\curl_setopt($ch, CURLOPT_POST, true);
789789
\curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
790790
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
791-
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
791+
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)Http::getEnv('OPR_EXECUTOR_CONNECT_TIMEOUT', '10'));
792792

793793
\curl_setopt($ch, CURLOPT_HTTPHEADER, [
794794
'Content-Type: application/json',
@@ -905,7 +905,7 @@ public function createExecution(
905905
\curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
906906
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
907907
\curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
908-
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
908+
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)Http::getEnv('OPR_EXECUTOR_CONNECT_TIMEOUT', '10'));
909909

910910
\curl_setopt($ch, CURLOPT_HTTPHEADER, [
911911
'Content-Type: application/json',
@@ -995,7 +995,7 @@ public function createExecution(
995995
});
996996

997997
\curl_setopt($ch, CURLOPT_TIMEOUT, $timeout + 5); // Gives extra 5s after safe timeout to recieve response
998-
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
998+
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int)Http::getEnv('OPR_EXECUTOR_CONNECT_TIMEOUT', '5'));
999999
if ($logging === true) {
10001000
$headers['x-open-runtimes-logging'] = 'enabled';
10011001
} else {

0 commit comments

Comments
 (0)