From 6ddce7944ecceff0e9ee23e90892d0369019e769 Mon Sep 17 00:00:00 2001 From: Enkidu93 Date: Wed, 16 Oct 2024 14:08:31 -0400 Subject: [PATCH] Collapse query --- .../Services/UnitializedEntityCleanupService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Serval/src/Serval.Translation/Services/UnitializedEntityCleanupService.cs b/src/Serval/src/Serval.Translation/Services/UnitializedEntityCleanupService.cs index 2730a08c..d6e71fae 100644 --- a/src/Serval/src/Serval.Translation/Services/UnitializedEntityCleanupService.cs +++ b/src/Serval/src/Serval.Translation/Services/UnitializedEntityCleanupService.cs @@ -23,9 +23,8 @@ protected override async Task DoWorkAsync(IServiceScope scope, CancellationToken public async Task CheckEntitiesAsync(IRepository entities, CancellationToken cancellationToken) { - IReadOnlyList allEntities = await entities.GetAllAsync(cancellationToken); var now = DateTime.UtcNow; - IEnumerable uninitializedEntities = allEntities.Where(b => + IEnumerable uninitializedEntities = (await entities.GetAllAsync(cancellationToken)).Where(b => !(b.IsInitialized ?? true) && (now - (b.DateCreated ?? DateTime.UtcNow)) > _timeout ); foreach (T entity in uninitializedEntities)