fix some existing issues
This commit is contained in:
@@ -131,7 +131,10 @@ public sealed class PerformanceCollectorService : IHostedService
|
||||
DrawSeparator(sb, longestCounterName);
|
||||
}
|
||||
|
||||
var pastEntries = limitBySeconds > 0 ? entry.Value.Where(e => e.Item1.AddMinutes(limitBySeconds / 60.0d) >= TimeOnly.FromDateTime(DateTime.Now)).ToList() : [.. entry.Value];
|
||||
var snapshot = entry.Value.Snapshot();
|
||||
var pastEntries = limitBySeconds > 0
|
||||
? snapshot.Where(e => e.Item1.AddMinutes(limitBySeconds / 60.0d) >= TimeOnly.FromDateTime(DateTime.Now)).ToList()
|
||||
: snapshot;
|
||||
|
||||
if (pastEntries.Any())
|
||||
{
|
||||
@@ -189,7 +192,11 @@ public sealed class PerformanceCollectorService : IHostedService
|
||||
{
|
||||
try
|
||||
{
|
||||
var last = entries.Value.ToList()[^1];
|
||||
if (!entries.Value.TryGetLast(out var last))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (last.Item1.AddMinutes(10) < TimeOnly.FromDateTime(DateTime.Now) && !PerformanceCounters.TryRemove(entries.Key, out _))
|
||||
{
|
||||
_logger.LogDebug("Could not remove performance counter {counter}", entries.Key);
|
||||
|
||||
Reference in New Issue
Block a user