From 585ee4b88e023233ddb2a5a9e69115fe0e84c8a3 Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Tue, 24 Sep 2024 15:18:35 +0900 Subject: [PATCH] Get tests passing --- src/Appwrite/Platform/Workers/UsageDump.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/UsageDump.php b/src/Appwrite/Platform/Workers/UsageDump.php index f2f4ad654c..4261ac1d4d 100644 --- a/src/Appwrite/Platform/Workers/UsageDump.php +++ b/src/Appwrite/Platform/Workers/UsageDump.php @@ -76,7 +76,11 @@ class UsageDump extends Action } if (str_contains($key, METRIC_DATABASES_STORAGE)) { - $this->handleDatabaseStorage($key, $dbForProject); + try { + $this->handleDatabaseStorage($key, $dbForProject); + } catch (\Exception $e) { + console::error('[' . DateTime::now() . '] failed to calculate database storage for key [' . $key . '] ' . $e->getMessage()); + } continue; } @@ -170,6 +174,7 @@ class UsageDump extends Action switch (count($data)) { // Collection Level case METRIC_COLLECTION_LEVEL_STORAGE: + Console::log('[' . DateTime::now() . '] Collection Level Storage Calculation [' . $key . ']'); $databaseInternalId = $data[0]; $collectionInternalId = $data[1]; @@ -200,6 +205,7 @@ class UsageDump extends Action break; // Database Level case METRIC_DATABASE_LEVEL_STORAGE: + Console::log('[' . DateTime::now() . '] Database Level Storage Calculation [' . $key . ']'); $databaseInternalId = $data[0]; $collections = $dbForProject->find('database_' . $databaseInternalId); @@ -227,6 +233,7 @@ class UsageDump extends Action break; // Project Level case METRIC_PROJECT_LEVEL_STORAGE: + Console::log('[' . DateTime::now() . '] Project Level Storage Calculation [' . $key . ']'); // Get all project databases $databases = $dbForProject->find('database');