From eb7cfc13566aa78a2cb5e8c4f237b5ba026d878d Mon Sep 17 00:00:00 2001 From: Jared Goodwin Date: Mon, 15 May 2023 17:47:48 -0700 Subject: [PATCH] Use ExecuteDeleteAsync to speed up deletion of all server logs. --- Server/Services/DataService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/Services/DataService.cs b/Server/Services/DataService.cs index 423b4d06f..8c8c7f5a8 100644 --- a/Server/Services/DataService.cs +++ b/Server/Services/DataService.cs @@ -655,12 +655,12 @@ public async Task ClearLogs(string currentUserName) { if (currentUser.IsServerAdmin) { - dbContext.EventLogs.RemoveRange(dbContext.EventLogs); + await dbContext.EventLogs.ExecuteDeleteAsync(); } else { var eventLogs = dbContext.EventLogs.Where(x => x.OrganizationID == currentUser.OrganizationID); - dbContext.EventLogs.RemoveRange(eventLogs); + await eventLogs.ExecuteDeleteAsync(); } await dbContext.SaveChangesAsync();