From 91c319bc5070295360d397a8480e33d66b1bf0f5 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 24 Jan 2025 00:09:08 +1300 Subject: [PATCH] Remove redundant logs --- src/Appwrite/Platform/Workers/Usage.php | 16 ++++++---------- src/Appwrite/Platform/Workers/UsageDump.php | 8 +------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Usage.php b/src/Appwrite/Platform/Workers/Usage.php index 3687eeab67..3f7428d0dd 100644 --- a/src/Appwrite/Platform/Workers/Usage.php +++ b/src/Appwrite/Platform/Workers/Usage.php @@ -30,16 +30,13 @@ class Usage extends Action */ public function __construct() { - $this - ->desc('Usage worker') - ->inject('message') - ->inject('project') - ->inject('getProjectDB') - ->inject('queueForUsageDump') - ->callback(function (Message $message, Document $project, callable $getProjectDB, UsageDump $queueForUsageDump) { - $this->action($message, $project, $getProjectDB, $queueForUsageDump); - }); + ->desc('Usage worker') + ->inject('message') + ->inject('project') + ->inject('getProjectDB') + ->inject('queueForUsageDump') + ->callback([$this, 'action']); $this->aggregationInterval = (int) System::getEnv('_APP_USAGE_AGGREGATION_INTERVAL', '20'); $this->lastTriggeredTime = time(); @@ -61,7 +58,6 @@ class Usage extends Action throw new Exception('Missing payload'); } - if (empty($project->getAttribute('database'))) { var_dump($payload); return; diff --git a/src/Appwrite/Platform/Workers/UsageDump.php b/src/Appwrite/Platform/Workers/UsageDump.php index 7d11bab3ce..b75d2ac47f 100644 --- a/src/Appwrite/Platform/Workers/UsageDump.php +++ b/src/Appwrite/Platform/Workers/UsageDump.php @@ -132,8 +132,6 @@ class UsageDump extends Action switch (\count($data)) { case METRIC_COLLECTION_LEVEL_STORAGE: - Console::log('[' . DateTime::now() . '] Collection Level Storage Calculation [' . $key . ']'); - $databaseInternalId = $data[0]; $collectionInternalId = $data[1]; $collectionId = "database_{$databaseInternalId}_collection_{$collectionInternalId}"; @@ -168,7 +166,6 @@ class UsageDump extends Action break; case METRIC_DATABASE_LEVEL_STORAGE: - Console::log('[' . DateTime::now() . '] Database Level Storage Calculation [' . $key . ']'); $databaseInternalId = $data[0]; $databaseId = "database_{$databaseInternalId}"; @@ -268,10 +265,7 @@ class UsageDump extends Action foreach ($keys as $metric) { $projectDocuments[] = $this->createStatsDocument($id, $period, $time, $metric, $diff); } - - break; - default: - Console::log('Unknown storage level.'); + break; } }