diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 69086b4fca..8c7611b79c 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -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); diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index acef40382a..43578fa6c2 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -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