diff --git a/app/controllers/general.php b/app/controllers/general.php index f31d0522d8..afc126838d 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -370,6 +370,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo $queueForFunctions ->setType('delayed_execution_write') ->setExecution($execution) + ->setProject($project) ->trigger(); } diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 5b917b5ac9..aa88f5cfce 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -72,6 +72,14 @@ class Functions extends Action } $type = $payload['type'] ?? ''; + + // Short-term solution to offhand write operation from API contianer + if ($type === 'delayed_execution_write') { + $execution = new Document($payload['execution'] ?? []); + $execution = $dbForProject->createDocument('executions', $execution); + return; + } + $events = $payload['events'] ?? []; $data = $payload['body'] ?? ''; $eventData = $payload['payload'] ?? ''; @@ -209,11 +217,6 @@ class Functions extends Action executionId: $execution->getId() ?? null ); break; - case 'delayed_execution_write': - $execution = new Document($payload['execution'] ?? []); - $execution->setAttribute('$collection', 'executions'); - $execution = $dbForProject->createDocument('executions', $execution); - return; } }