Introduce execution sync timeout

This commit is contained in:
Matej Bačo
2023-09-30 11:54:54 +02:00
parent c27d5cb721
commit d9f2f1c37b
3 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -177,6 +177,7 @@ class Executor
string $method,
array $headers,
string $runtimeEntrypoint = null,
int $requestTimeout = null
) {
if (empty($headers['host'])) {
$headers['host'] = App::getEnv('_APP_DOMAIN', '');
@@ -204,9 +205,11 @@ class Executor
// Safety timeout. Executor has timeout, and open runtime has soft timeout.
// This one shouldn't really happen, but prevents from unexpected networking behaviours.
$timeout = $timeout + 15;
if($requestTimeout == null) {
$requestTimeout = $timeout + 15;
}
$response = $this->call(self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout);
$response = $this->call(self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $requestTimeout);
$status = $response['headers']['status-code'];
if ($status >= 400) {