mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
feat: review comments
This commit is contained in:
+1
-5
@@ -395,17 +395,13 @@ App::delete('/v1/runtimes/:runtimeId')
|
||||
App::post('/v1/execution')
|
||||
->desc('Create an execution')
|
||||
->param('runtimeId', '', new Text(64), 'The runtimeID to execute')
|
||||
->param('path', '', new Text(0), 'Path containing the built files.', false)
|
||||
->param('vars', [], new Assoc(), 'Environment variables required for the build', false)
|
||||
->param('data', '', new Text(8192), 'Data to be forwarded to the function, this is user specified.', true)
|
||||
->param('runtime', '', new Text(128), 'Runtime for the cloud function', false)
|
||||
->param('entrypoint', '', new Text(256), 'Entrypoint of the code file')
|
||||
->param('timeout', 15, new ValidatorRange(1, 900), 'Function maximum execution time in seconds.', true)
|
||||
->param('baseImage', '', new Text(128), 'Base image name of the runtime', false)
|
||||
->inject('activeRuntimes')
|
||||
->inject('response')
|
||||
->action(
|
||||
function (string $runtimeId, string $path, array $vars, string $data, string $runtime, string $entrypoint, $timeout, string $baseImage, $activeRuntimes, Response $response) {
|
||||
function (string $runtimeId, array $vars, string $data, $timeout, $activeRuntimes, Response $response) {
|
||||
|
||||
if (!$activeRuntimes->exists($runtimeId)) {
|
||||
throw new Exception('Runtime not found. Please create the runtime.', 404);
|
||||
|
||||
@@ -114,7 +114,6 @@ class BuildsV1 extends Worker
|
||||
try {
|
||||
$response = $this->executor->createRuntime(
|
||||
projectId: $projectId,
|
||||
functionId: $functionId,
|
||||
deploymentId: $deploymentId,
|
||||
entrypoint: $deployment->getAttribute('entrypoint'),
|
||||
source: $source,
|
||||
|
||||
@@ -371,7 +371,7 @@ class DeletesV1 extends Worker
|
||||
$executor = new Executor();
|
||||
foreach ($deploymentIds as $deploymentId) {
|
||||
try {
|
||||
$executor->deleteRuntime($projectId, $functionId, $deploymentId);
|
||||
$executor->deleteRuntime($projectId, $deploymentId);
|
||||
} catch (Throwable $th) {
|
||||
Console::error($th->getMessage());
|
||||
}
|
||||
@@ -421,7 +421,7 @@ class DeletesV1 extends Worker
|
||||
Console::info("Requesting executor to delete deployment container for deployment " . $deploymentId);
|
||||
try {
|
||||
$executor = new Executor();
|
||||
$executor->deleteRuntime($projectId, $functionId, $deploymentId);
|
||||
$executor->deleteRuntime($projectId, $deploymentId);
|
||||
} catch (Throwable $th) {
|
||||
Console::error($th->getMessage());
|
||||
}
|
||||
|
||||
@@ -290,7 +290,6 @@ class FunctionsV1 extends Worker
|
||||
try {
|
||||
$executionResponse = $this->executor->createExecution(
|
||||
projectId: $projectId,
|
||||
functionId: $functionId,
|
||||
deploymentId: $deploymentId,
|
||||
path: $build->getAttribute('outputPath', ''),
|
||||
vars: $vars,
|
||||
|
||||
@@ -32,7 +32,6 @@ class Executor
|
||||
}
|
||||
|
||||
public function createRuntime(
|
||||
string $functionId,
|
||||
string $deploymentId,
|
||||
string $projectId,
|
||||
string $source,
|
||||
@@ -75,7 +74,7 @@ class Executor
|
||||
return $response['body'];
|
||||
}
|
||||
|
||||
public function deleteRuntime(string $projectId, string $functionId, string $deploymentId)
|
||||
public function deleteRuntime(string $projectId, string $deploymentId)
|
||||
{
|
||||
$runtimeId = "$projectId-$deploymentId";
|
||||
$route = "/runtimes/$runtimeId";
|
||||
@@ -98,7 +97,6 @@ class Executor
|
||||
|
||||
public function createExecution(
|
||||
string $projectId,
|
||||
string $functionId,
|
||||
string $deploymentId,
|
||||
string $path,
|
||||
array $vars,
|
||||
@@ -116,13 +114,9 @@ class Executor
|
||||
];
|
||||
$params = [
|
||||
'runtimeId' => "$projectId-$deploymentId",
|
||||
'path' => $path,
|
||||
'vars' => $vars,
|
||||
'data' => $data,
|
||||
'runtime' => $runtime,
|
||||
'entrypoint' => $entrypoint,
|
||||
'timeout' => $timeout,
|
||||
'baseImage' => $baseImage,
|
||||
];
|
||||
|
||||
$response = $this->call(self::METHOD_POST, $route, $headers, $params, true, 30);
|
||||
@@ -133,7 +127,6 @@ class Executor
|
||||
switch ($status) {
|
||||
case 404:
|
||||
$response = $this->createRuntime(
|
||||
functionId: $functionId,
|
||||
deploymentId: $deploymentId,
|
||||
projectId: $projectId,
|
||||
source: $path,
|
||||
|
||||
Reference in New Issue
Block a user