mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Cold-start improvements
This commit is contained in:
1 parent
20e3eb78fb
commit
fb1cc1a0cc
3 files changed
+7
-7
No files matched your search
@@ -1521,7 +1521,7 @@ App::post('/v1/functions/:functionId/executions')
|
||||
/** Execute function */
|
||||
$executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST'));
|
||||
try {
|
||||
$command = 'npm start'; // TODO: Custom for each runtime
|
||||
$command = 'node src/server.js'; // TODO: Custom for each runtime
|
||||
$executionResponse = $executor->createExecution(
|
||||
projectId: $project->getId(),
|
||||
deploymentId: $deployment->getId(),
|
||||
@@ -1535,7 +1535,7 @@ App::post('/v1/functions/:functionId/executions')
|
||||
path: $path,
|
||||
method: $method,
|
||||
headers: $headers,
|
||||
command: 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '" &>/dev/null &'
|
||||
runtimeEntrypoint: 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '"'
|
||||
);
|
||||
|
||||
/** Update execution status */
|
||||
|
||||
@@ -166,7 +166,7 @@ Server::setResource('execute', function () {
|
||||
|
||||
/** Execute function */
|
||||
try {
|
||||
$command = 'npm start'; // TODO: Custom for each runtime
|
||||
$command = 'node src/server.js'; // TODO: Custom for each runtime
|
||||
$client = new Executor(App::getEnv('_APP_EXECUTOR_HOST'));
|
||||
$executionResponse = $client->createExecution(
|
||||
projectId: $project->getId(),
|
||||
@@ -181,7 +181,7 @@ Server::setResource('execute', function () {
|
||||
path: $path,
|
||||
method: $method,
|
||||
headers: $headers,
|
||||
command: 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '" &>/dev/null &'
|
||||
runtimeEntrypoint: 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '"'
|
||||
);
|
||||
|
||||
$status = $executionResponse['statusCode'] >= 400 ? 'failed' : 'completed';
|
||||
|
||||
@@ -162,7 +162,7 @@ class Executor
|
||||
* @param string $image
|
||||
* @param string $source
|
||||
* @param string $entrypoint
|
||||
* @param string $command
|
||||
* @param string $runtimeEntrypoint
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -179,7 +179,7 @@ class Executor
|
||||
string $path,
|
||||
string $method,
|
||||
array $headers,
|
||||
string $command = null,
|
||||
string $runtimeEntrypoint = null,
|
||||
) {
|
||||
$headers['host'] = App::getEnv('_APP_DOMAIN', '');
|
||||
|
||||
@@ -200,7 +200,7 @@ class Executor
|
||||
'cpus' => $this->cpus,
|
||||
'memory' => $this->memory,
|
||||
'version' => $version,
|
||||
'command' => $command,
|
||||
'runtimeEntrypoint' => $runtimeEntrypoint,
|
||||
];
|
||||
|
||||
$timeout = (int) App::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900);
|
||||
|
||||
Reference in new issue
Block a user