mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
More PR reviews
This commit is contained in:
parent
e37f70246e
commit
5f8d3ff6ee
2 changed files with 11 additions and 16 deletions
|
|
@ -27,18 +27,18 @@ Authorization::setDefaultStatus(false);
|
||||||
|
|
||||||
Server::setResource('execute', function () {
|
Server::setResource('execute', function () {
|
||||||
return function (
|
return function (
|
||||||
|
Func $queueForFunctions,
|
||||||
|
Database $dbForProject,
|
||||||
|
Client $statsd,
|
||||||
Document $project,
|
Document $project,
|
||||||
Document $function,
|
Document $function,
|
||||||
Database $dbForProject,
|
|
||||||
Func $queueForFunctions,
|
|
||||||
string $trigger,
|
string $trigger,
|
||||||
string $executionId = null,
|
|
||||||
string $event = null,
|
|
||||||
string $eventData = null,
|
|
||||||
string $data = null,
|
string $data = null,
|
||||||
?Document $user = null,
|
?Document $user = null,
|
||||||
string $jwt = null,
|
string $jwt = null,
|
||||||
Client $statsd
|
string $event = null,
|
||||||
|
string $eventData = null,
|
||||||
|
string $executionId = null,
|
||||||
) {
|
) {
|
||||||
$user ??= new Document();
|
$user ??= new Document();
|
||||||
$functionId = $function->getId();
|
$functionId = $function->getId();
|
||||||
|
|
@ -124,11 +124,11 @@ Server::setResource('execute', function () {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** Execute function */
|
/** Execute function */
|
||||||
$executor = new Executor(App::getEnv('_APP_EXECUTOR_HOST'));
|
|
||||||
try {
|
try {
|
||||||
$executionResponse = $executor->createExecution(
|
$client = new Executor(App::getEnv('_APP_EXECUTOR_HOST'));
|
||||||
|
$executionResponse = $client->createExecution(
|
||||||
projectId: $project->getId(),
|
projectId: $project->getId(),
|
||||||
deploymentId: $deployment->getId(),
|
deploymentId: $deploymentId,
|
||||||
payload: $vars['APPWRITE_FUNCTION_DATA'] ?? '',
|
payload: $vars['APPWRITE_FUNCTION_DATA'] ?? '',
|
||||||
variables: $vars,
|
variables: $vars,
|
||||||
timeout: $function->getAttribute('timeout', 0),
|
timeout: $function->getAttribute('timeout', 0),
|
||||||
|
|
@ -171,12 +171,7 @@ Server::setResource('execute', function () {
|
||||||
|
|
||||||
/** Trigger Functions */
|
/** Trigger Functions */
|
||||||
$queueForFunctions
|
$queueForFunctions
|
||||||
->setData($data ?? '')
|
->from($executionUpdate)
|
||||||
->setProject($project)
|
|
||||||
->setUser($user)
|
|
||||||
->setEvent('functions.[functionId].executions.[executionId].update')
|
|
||||||
->setParam('functionId', $function->getId())
|
|
||||||
->setParam('executionId', $execution->getId())
|
|
||||||
->trigger();
|
->trigger();
|
||||||
|
|
||||||
/** Trigger realtime event */
|
/** Trigger realtime event */
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class Func extends Event
|
||||||
'execution' => $this->execution,
|
'execution' => $this->execution,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'jwt' => $this->jwt,
|
'jwt' => $this->jwt,
|
||||||
'payload' => '',
|
'payload' => $this->payload,
|
||||||
'events' => $events,
|
'events' => $events,
|
||||||
'data' => $this->data,
|
'data' => $this->data,
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue