Skip to content

Commit

Permalink
Fix issue with null coalescing operator in filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Oct 18, 2024
1 parent 113ba28 commit 75ab49d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/Serval/src/Serval.Translation/Services/BuildService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task<IEnumerable<Build>> GetAllAsync(string parentId, CancellationT
return Entities.GetAsync(
b =>
b.EngineRef == parentId
&& (b.IsInitialized ?? true)
&& (b.IsInitialized == null || b.IsInitialized.Value)
&& (b.State == JobState.Active || b.State == JobState.Pending),
cancellationToken
);
Expand All @@ -24,7 +24,11 @@ public Task<EntityChange<Build>> GetNewerRevisionAsync(
CancellationToken cancellationToken = default
)
{
return GetNewerRevisionAsync(e => e.Id == id && (e.IsInitialized ?? true), minRevision, cancellationToken);
return GetNewerRevisionAsync(
e => e.Id == id && (e.IsInitialized == null || e.IsInitialized.Value),
minRevision,
cancellationToken
);
}

public Task<EntityChange<Build>> GetActiveNewerRevisionAsync(
Expand All @@ -36,7 +40,7 @@ public Task<EntityChange<Build>> GetActiveNewerRevisionAsync(
return GetNewerRevisionAsync(
b =>
b.EngineRef == parentId
&& (b.IsInitialized ?? true)
&& (b.IsInitialized == null || b.IsInitialized.Value)
&& (b.State == JobState.Active || b.State == JobState.Pending),
minRevision,
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public async Task CheckEntitiesAsync(IRepository<T> entities, CancellationToken
{
var now = DateTime.UtcNow;
IEnumerable<T> uninitializedEntities = await entities.GetAllAsync(
e => !(e.IsInitialized ?? true) && e.DateCreated != null && (now - e.DateCreated) > _timeout,
e =>
e.IsInitialized != null
&& !e.IsInitialized.Value
&& e.DateCreated != null
&& (now - e.DateCreated) > _timeout,
cancellationToken
);

Expand Down

0 comments on commit 75ab49d

Please sign in to comment.