Fix db issues

This commit is contained in:
Matej Bačo 2024-10-11 13:32:48 +00:00
parent d1ab8c4df8
commit 8fea73d3bf
2 changed files with 9 additions and 5 deletions

View file

@ -370,6 +370,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
$queueForFunctions $queueForFunctions
->setType('delayed_execution_write') ->setType('delayed_execution_write')
->setExecution($execution) ->setExecution($execution)
->setProject($project)
->trigger(); ->trigger();
} }

View file

@ -72,6 +72,14 @@ class Functions extends Action
} }
$type = $payload['type'] ?? ''; $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'] ?? []; $events = $payload['events'] ?? [];
$data = $payload['body'] ?? ''; $data = $payload['body'] ?? '';
$eventData = $payload['payload'] ?? ''; $eventData = $payload['payload'] ?? '';
@ -209,11 +217,6 @@ class Functions extends Action
executionId: $execution->getId() ?? null executionId: $execution->getId() ?? null
); );
break; break;
case 'delayed_execution_write':
$execution = new Document($payload['execution'] ?? []);
$execution->setAttribute('$collection', 'executions');
$execution = $dbForProject->createDocument('executions', $execution);
return;
} }
} }