Skip to content

Commit

Permalink
Use ExecuteDeleteAsync to speed up deletion of all server logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed May 16, 2023
1 parent 9ea17ad commit eb7cfc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Server/Services/DataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit eb7cfc1

Please sign in to comment.