8000 Patch: Sync executions timeout by Meldiron · Pull Request #6370 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Patch: Sync executions timeout #6370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/controllers/api/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,8 @@
path: $path,
method: $method,
headers: $headers,
runtimeEntrypoint: $command
runtimeEntrypoint: $command,
requestTimeout: 30
);

$headersFiltered = [];
Expand Down
1 change: 1 addition & 0 deletions app/controllers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ function router(App $utopia, Database $dbForConsole, SwooleRequest $swooleReques
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// \curl_setopt($ch, CURLOPT_HEADER, true);
\curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
\curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$executionResponse = \curl_exec($ch);
$statusCode = \curl_getinfo($ch, CURLINFO_HTTP_CODE);
Expand Down
7 changes: 5 additions & 2 deletions src/Executor/Executor.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public function createExecution(
string $method,
array $headers,
string $runtimeEntrypoint = null,
int $requestTimeout = null
) {
if (empty($headers['host'])) {
$headers['host'] = App::getEnv('_APP_DOMAIN', '');
Expand Down Expand Up @@ -204,9 +205,11 @@ public function createExecution(

// 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) {
Expand Down
0