1
0
Fork 0
mirror of synced 2024-09-18 18:40:24 +12:00

Create execution even when logging is disabled

This commit is contained in:
Khushboo Verma 2024-06-28 19:51:33 +05:30
parent e5fd3619f7
commit 66c761b73e
2 changed files with 8 additions and 17 deletions

View file

@ -1702,6 +1702,7 @@ App::post('/v1/functions/:functionId/executions')
}
$executionId = ID::unique();
var_dump("creating execution document");
$execution = new Document([
'$id' => $executionId,
@ -1729,10 +1730,7 @@ App::post('/v1/functions/:functionId/executions')
->setContext('function', $function);
if ($async) {
if ($function->getAttribute('logging')) {
/** @var Document $execution */
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution));
}
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution));
$queueForFunctions
->setType('http')
@ -1850,10 +1848,7 @@ App::post('/v1/functions/:functionId/executions')
;
}
if ($function->getAttribute('logging')) {
/** @var Document $execution */
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution));
}
$execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution));
$roles = Authorization::getRoles();
$isPrivilegedUser = Auth::isPrivilegedUser($roles);

View file

@ -328,9 +328,7 @@ class Functions extends Action
'search' => implode(' ', [$functionId, $executionId]),
]);
if ($function->getAttribute('logging')) {
$execution = $dbForProject->createDocument('executions', $execution);
}
$execution = $dbForProject->createDocument('executions', $execution);
// TODO: @Meldiron Trigger executions.create event here
@ -342,9 +340,7 @@ class Functions extends Action
if ($execution->getAttribute('status') !== 'processing') {
$execution->setAttribute('status', 'processing');
if ($function->getAttribute('logging')) {
$execution = $dbForProject->updateDocument('executions', $executionId, $execution);
}
$execution = $dbForProject->updateDocument('executions', $executionId, $execution);
}
$durationStart = \microtime(true);
@ -455,9 +451,9 @@ class Functions extends Action
;
}
if ($function->getAttribute('logging')) {
$execution = $dbForProject->updateDocument('executions', $executionId, $execution);
}
$execution = $dbForProject->updateDocument('executions', $executionId, $execution);
/** Trigger Webhook */
$executionModel = new Execution();
$queueForEvents