mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
error fixes
This commit is contained in:
parent
05152da195
commit
d39165889e
2 changed files with 4 additions and 4 deletions
|
|
@ -186,7 +186,7 @@ class Usage
|
||||||
if ($document->isEmpty()) {
|
if ($document->isEmpty()) {
|
||||||
$this->database->createDocument('stats', new Document([
|
$this->database->createDocument('stats', new Document([
|
||||||
'$id' => $id,
|
'$id' => $id,
|
||||||
'period' => $period['key'],
|
'period' => $period,
|
||||||
'time' => $time,
|
'time' => $time,
|
||||||
'metric' => $metric,
|
'metric' => $metric,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
|
|
@ -199,7 +199,7 @@ class Usage
|
||||||
$document->setAttribute('value', $value)
|
$document->setAttribute('value', $value)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->latestTime[$metric][$period['key']] = $time;
|
$this->latestTime[$metric][$period] = $time;
|
||||||
} catch (\Exception $e) { // if projects are deleted this might fail
|
} catch (\Exception $e) { // if projects are deleted this might fail
|
||||||
if (is_callable($this->errorHandler)) {
|
if (is_callable($this->errorHandler)) {
|
||||||
call_user_func($this->errorHandler, "Unable to save data for project {$projectId} and metric {$metric}: {$e->getMessage()}", $e->getTraceAsString());
|
call_user_func($this->errorHandler, "Unable to save data for project {$projectId} and metric {$metric}: {$e->getMessage()}", $e->getTraceAsString());
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class UsageDB extends Usage
|
||||||
if ($document->isEmpty()) {
|
if ($document->isEmpty()) {
|
||||||
$this->database->createDocument('stats', new Document([
|
$this->database->createDocument('stats', new Document([
|
||||||
'$id' => $id,
|
'$id' => $id,
|
||||||
'period' => $period['key'],
|
'period' => $period,
|
||||||
'time' => $time,
|
'time' => $time,
|
||||||
'metric' => $metric,
|
'metric' => $metric,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
|
|
@ -179,7 +179,7 @@ class UsageDB extends Usage
|
||||||
$this->foreachDocument($projectId, 'buckets', [], function ($bucket) use (&$projectFilesCount, &$projectFilesTotal, $projectId,) {
|
$this->foreachDocument($projectId, 'buckets', [], function ($bucket) use (&$projectFilesCount, &$projectFilesTotal, $projectId,) {
|
||||||
$metric = "storage.buckets.{$bucket->getId()}.files.count";
|
$metric = "storage.buckets.{$bucket->getId()}.files.count";
|
||||||
|
|
||||||
$count = $this->count($projectId, 'buckets_' . $bucket->getInternalId(), $metric);
|
$count = $this->count($projectId, 'bucket_' . $bucket->getInternalId(), $metric);
|
||||||
$projectFilesCount += $count;
|
$projectFilesCount += $count;
|
||||||
|
|
||||||
$metric = "storage.buckets.{$bucket->getId()}.files.total";
|
$metric = "storage.buckets.{$bucket->getId()}.files.total";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue