mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Use bulk deletes for audit cleanup
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user