Skip to content

Commit fbd277f

Browse files
executor: pass build timeout to runtimes (appwrite#7350)
open-runtimes executor (v1/runtimes) supports passing a timeout parameter that defaults to 600 seconds. ->param('timeout', 600, new Integer(), 'Commands execution time in seconds.', true) https://github.com/open-runtimes/executor/blob/main/app/http.php#L383 This change passes the _APP_FUNCTIONS_BUILD_TIMEOUT env var.
1 parent 80f5ded commit fbd277f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Executor/Executor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function createRuntime(
7272
) {
7373
$runtimeId = "$projectId-$deploymentId-build";
7474
$route = "/runtimes";
75+
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
7576
$params = [
7677
'runtimeId' => $runtimeId,
7778
'source' => $source,
@@ -84,10 +85,9 @@ public function createRuntime(
8485
'cpus' => $this->cpus,
8586
'memory' => $this->memory,
8687
'version' => $version,
88+
'timeout' => $timeout,
8789
];
8890

89-
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
90-
9191
$response = $this->call(self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
9292

9393
$status = $response['headers']['status-code'];
@@ -111,7 +111,7 @@ public function getLogs(
111111
string $projectId,
112112
callable $callback
113113
) {
114-
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
114+
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
115115

116116
$runtimeId = "$projectId-$deploymentId-build";
117117
$route = "/runtimes/{$runtimeId}/logs";

0 commit comments

Comments
 (0)