mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Use bulk deletes for audit cleanup
This commit is contained in:
parent
d4dd7fb757
commit
2052fb975b
1 changed files with 5 additions and 3 deletions
|
|
@ -732,10 +732,12 @@ class Deletes extends Action
|
|||
{
|
||||
$projectId = $project->getId();
|
||||
$dbForProject = $getProjectDB($project);
|
||||
$audit = new Audit($dbForProject);
|
||||
|
||||
try {
|
||||
$audit->cleanup($auditRetention);
|
||||
$this->deleteByGroup(Audit::COLLECTION, [
|
||||
Query::lessThan('time', $auditRetention),
|
||||
Query::orderDesc('time'),
|
||||
], $dbForProject);
|
||||
} catch (DatabaseException $e) {
|
||||
Console::error('Failed to delete audit logs for project ' . $projectId . ': ' . $e->getMessage());
|
||||
}
|
||||
|
|
@ -943,7 +945,7 @@ class Deletes extends Action
|
|||
* @param Database $database
|
||||
* @param ?callable $callback
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws DatabaseException
|
||||
*/
|
||||
protected function deleteByGroup(
|
||||
string $collection,
|
||||
|
|
|
|||
Loading…
Reference in a new issue