Implement UNIX Exit Code suggestion
This commit is contained in:
parent
1a8bed396a
commit
80fef728b4
|
@ -440,7 +440,7 @@ class FunctionsV1 extends Worker
|
|||
$exitCode = 0;
|
||||
|
||||
try {
|
||||
$exitCode = $orchestration->execute(
|
||||
$exitCode = (int)!$orchestration->execute(
|
||||
name: $container,
|
||||
command: $orchestration->parseCommandString($command),
|
||||
stdout: $stdout,
|
||||
|
@ -448,12 +448,12 @@ class FunctionsV1 extends Worker
|
|||
vars: $vars,
|
||||
timeout: $function->getAttribute('timeout', (int) App::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)));
|
||||
} catch (TimeoutException $e) {
|
||||
$exitCode = 0;
|
||||
$exitCode = 124;
|
||||
}
|
||||
|
||||
$executionEnd = \microtime(true);
|
||||
$executionTime = ($executionEnd - $executionStart);
|
||||
$functionStatus = $exitCode ? 'completed' : 'failed';
|
||||
$functionStatus = ($exitCode === 0) ? 'completed' : 'failed';
|
||||
|
||||
Console::info('Function executed in ' . ($executionEnd - $executionStart) . ' seconds, status: ' . $functionStatus);
|
||||
|
||||
|
@ -462,7 +462,7 @@ class FunctionsV1 extends Worker
|
|||
$execution = $database->updateDocument(array_merge($execution->getArrayCopy(), [
|
||||
'tagId' => $tag->getId(),
|
||||
'status' => $functionStatus,
|
||||
'exitCode' => ($exitCode ? 0 : 1),
|
||||
'exitCode' => ($exitCode === 0 ? 0 : 1),
|
||||
'stdout' => \mb_substr($stdout, -4000), // log last 4000 chars output
|
||||
'stderr' => \mb_substr($stderr, -4000), // log last 4000 chars output
|
||||
'time' => $executionTime
|
||||
|
|
8
composer.lock
generated
8
composer.lock
generated
|
@ -1913,12 +1913,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PineappleIOnic/orchestration.git",
|
||||
"reference": "d19c498731807aaadf583c58356011c8f39c53cf"
|
||||
"reference": "213d8796cd3b4a23b8d3728227b0e8ab1ceb4aea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PineappleIOnic/orchestration/zipball/d19c498731807aaadf583c58356011c8f39c53cf",
|
||||
"reference": "d19c498731807aaadf583c58356011c8f39c53cf",
|
||||
"url": "https://api.github.com/repos/PineappleIOnic/orchestration/zipball/213d8796cd3b4a23b8d3728227b0e8ab1ceb4aea",
|
||||
"reference": "213d8796cd3b4a23b8d3728227b0e8ab1ceb4aea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1963,7 +1963,7 @@
|
|||
"support": {
|
||||
"source": "https://github.com/PineappleIOnic/orchestration/tree/dev"
|
||||
},
|
||||
"time": "2021-08-11T10:38:19+00:00"
|
||||
"time": "2021-08-11T12:45:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/preloader",
|
||||
|
|
Loading…
Reference in a new issue