1
0
Fork 0
mirror of synced 2024-08-02 03:52:01 +12:00

fix usage task error

This commit is contained in:
Damodar Lohani 2022-10-14 11:01:45 +00:00
parent e5ad8d63f0
commit 72e112ade8

View file

@ -11,6 +11,7 @@ use Utopia\App;
use Utopia\CLI\Console; use Utopia\CLI\Console;
use Utopia\Database\Database as UtopiaDatabase; use Utopia\Database\Database as UtopiaDatabase;
use Utopia\Validator\WhiteList; use Utopia\Validator\WhiteList;
use Throwable;
class Usage extends Task class Usage extends Task
{ {
@ -73,13 +74,14 @@ class Usage extends Task
$database = $this->getDatabase($register, '_console'); $database = $this->getDatabase($register, '_console');
$influxDB = $this->getInfluxDB($register); $influxDB = $this->getInfluxDB($register);
$logError = fn(Throwable $error, string $action = 'syncUsageStats') => $this->logError($register, $error, $action);
switch ($type) { switch ($type) {
case 'timeseries': case 'timeseries':
$this->aggregateTimeseries($database, $influxDB, $this->logError); $this->aggregateTimeseries($database, $influxDB, $logError);
break; break;
case 'database': case 'database':
$this->aggregateDatabase($database, $this->logError); $this->aggregateDatabase($database, $logError);
break; break;
default: default:
Console::error("Unsupported usage aggregation type"); Console::error("Unsupported usage aggregation type");