mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 16:38:32 +00:00
Merge pull request #10469 from appwrite/stats-resources-try-catch
Stats resources try catch
This commit is contained in:
commit
27cc649376
1 changed files with 15 additions and 6 deletions
|
|
@ -432,11 +432,20 @@ class StatsResources extends Action
|
|||
|
||||
protected function writeDocuments(Database $dbForLogs, Document $project): void
|
||||
{
|
||||
$dbForLogs->createOrUpdateDocuments(
|
||||
'stats',
|
||||
$this->documents
|
||||
);
|
||||
$this->documents = [];
|
||||
Console::success('Stats written to logs db for project: ' . $project->getId() . '(' . $project->getSequence() . ')');
|
||||
$message = 'Stats writeDocuments project: ' . $project->getId() . '(' . $project->getSequence() . ')';
|
||||
|
||||
try {
|
||||
$dbForLogs->createOrUpdateDocuments(
|
||||
'stats',
|
||||
$this->documents
|
||||
);
|
||||
|
||||
Console::success($message . ' | Documents: ' . count($this->documents));
|
||||
} catch (\Throwable $e) {
|
||||
Console::error('Error: ' . $message . ' | Exception: ' . $e->getMessage());
|
||||
throw $e;
|
||||
} finally {
|
||||
$this->documents = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue