Skip to content

Commit 7709773

Browse files
committed
A few small updates
1 parent a9e8ac2 commit 7709773

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/ServiceControl.Persistence.Sql.Core/Implementation/CustomChecksDataStore.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task<QueryResult<IList<CustomCheck>>> GetStats(PagingInfo paging, s
7171
{
7272
query = query.Where(c => c.Status == (int)Status.Fail);
7373
}
74-
else if (status == "pass")
74+
if (status == "pass")
7575
{
7676
query = query.Where(c => c.Status == (int)Status.Pass);
7777
}
@@ -109,12 +109,7 @@ public async Task DeleteCustomCheck(Guid id)
109109
using var scope = serviceProvider.CreateScope();
110110
var dbContext = scope.ServiceProvider.GetRequiredService<ServiceControlDbContextBase>();
111111

112-
var customCheck = await dbContext.CustomChecks.FirstOrDefaultAsync(c => c.Id == id);
113-
if (customCheck != null)
114-
{
115-
dbContext.CustomChecks.Remove(customCheck);
116-
await dbContext.SaveChangesAsync();
117-
}
112+
await dbContext.CustomChecks.Where(c => c.Id == id).ExecuteDeleteAsync();
118113
}
119114

120115
public async Task<int> GetNumberOfFailedChecks()

src/ServiceControl.Persistence.Sql.Core/Implementation/EventLogDataStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task Add(EventLogItem logItem)
6969
RelatedTo = entity.RelatedTo != null ? JsonSerializer.Deserialize<List<string>>(entity.RelatedTo) : null
7070
}).ToList();
7171

72-
// Version could be based on the latest RaisedAt timestamp
72+
// Version could be based on the latest RaisedAt timestampn but the paging can affect this result, given that the latest may not be retrieved
7373
var version = entities.Any() ? entities.Max(e => e.RaisedAt).Ticks.ToString() : "0";
7474

7575
return (items, total, version);

0 commit comments

Comments
 (0)