mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Merge pull request #9494 from appwrite/fix-delete-usage-stats
chore: update initializing dbForLogs
This commit is contained in:
commit
4b1e4008a9
1 changed files with 11 additions and 6 deletions
|
|
@ -414,8 +414,8 @@ class Deletes extends Action
|
||||||
*/
|
*/
|
||||||
private function deleteUsageStats(Document $project, callable $getProjectDB, callable $getLogsDB, string $hourlyUsageRetentionDatetime): void
|
private function deleteUsageStats(Document $project, callable $getProjectDB, callable $getLogsDB, string $hourlyUsageRetentionDatetime): void
|
||||||
{
|
{
|
||||||
|
/** @var \Utopia\Database\Database $dbForProject*/
|
||||||
$dbForProject = $getProjectDB($project);
|
$dbForProject = $getProjectDB($project);
|
||||||
$dbForLogs = $getLogsDB($project);
|
|
||||||
|
|
||||||
// Delete Usage stats from projectDB
|
// Delete Usage stats from projectDB
|
||||||
$this->deleteByGroup('stats', [
|
$this->deleteByGroup('stats', [
|
||||||
|
|
@ -423,11 +423,16 @@ class Deletes extends Action
|
||||||
Query::equal('period', ['1h']),
|
Query::equal('period', ['1h']),
|
||||||
], $dbForProject);
|
], $dbForProject);
|
||||||
|
|
||||||
// Delete Usage stats from logsDB
|
if ($project->getId() !== 'console') {
|
||||||
$this->deleteByGroup('stats', [
|
/** @var \Utopia\Database\Database $dbForLogs*/
|
||||||
Query::lessThan('time', $hourlyUsageRetentionDatetime),
|
$dbForLogs = call_user_func($getLogsDB, $project);
|
||||||
Query::equal('period', ['1h']),
|
|
||||||
], $dbForLogs);
|
// Delete Usage stats from logsDB
|
||||||
|
$this->deleteByGroup('stats', [
|
||||||
|
Query::lessThan('time', $hourlyUsageRetentionDatetime),
|
||||||
|
Query::equal('period', ['1h']),
|
||||||
|
], $dbForLogs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue