diff --git a/.env b/.env index e52836f3a7..2e4b5fa5c7 100644 --- a/.env +++ b/.env @@ -111,4 +111,4 @@ _APP_MESSAGE_PUSH_TEST_DSN= _APP_WEBHOOK_MAX_FAILED_ATTEMPTS=10 _APP_PROJECT_REGIONS=default _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 -_APP_STATS_USAGE_DUAL_WRITING_DBS= \ No newline at end of file +_APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main \ No newline at end of file diff --git a/src/Appwrite/Platform/Workers/StatsUsageDump.php b/src/Appwrite/Platform/Workers/StatsUsageDump.php index eeb73dd378..1b5ec10151 100644 --- a/src/Appwrite/Platform/Workers/StatsUsageDump.php +++ b/src/Appwrite/Platform/Workers/StatsUsageDump.php @@ -150,13 +150,14 @@ class StatsUsageDump extends Action 'value' => $value, 'region' => System::getEnv('_APP_REGION', 'default'), ]); + $documentClone = new Document($document->getArrayCopy()); $dbForProject->createOrUpdateDocumentsWithIncrease( 'stats', 'value', [$document] ); - $this->writeToLogsDB($project, $document); + $this->writeToLogsDB($project, $documentClone); } } } catch (\Exception $e) { @@ -181,12 +182,13 @@ class StatsUsageDump extends Action 'value' => $value, 'region' => System::getEnv('_APP_REGION', 'default'), ]); + $documentClone = new Document($document->getArrayCopy()); $dbForProject->createOrUpdateDocumentsWithIncrease( 'stats', 'value', [$document] ); - $this->writeToLogsDB($project, $document); + $this->writeToLogsDB($project, $documentClone); }; foreach ($this->periods as $period => $format) { @@ -337,5 +339,6 @@ class StatsUsageDump extends Action 'value', [$document] ); + Console::success('Usage logs pushed to Logs DB'); } }