[OPTIMIZING]
This commit is contained in:
@@ -22,10 +22,11 @@ public class CircularBuffer <T>
|
||||
|
||||
Capacity = capacity;
|
||||
_buffer = new T[Capacity];
|
||||
_channel = Channel.CreateUnbounded<T>(new UnboundedChannelOptions
|
||||
_channel = Channel.CreateBounded<T>(new BoundedChannelOptions(Capacity)
|
||||
{
|
||||
SingleReader = false,
|
||||
SingleWriter = false,
|
||||
FullMode = BoundedChannelFullMode.DropOldest
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ public abstract class ExtendedBackgroundService : BackgroundService
|
||||
}
|
||||
}
|
||||
|
||||
protected void LogEvent(string message, LogSeverity severity = LogSeverity.Info) => ProgressEvents.Add(new ServiceEvent(Name, message, DateTime.UtcNow, severity));
|
||||
protected void LogEvent(string message, LogSeverity severity = LogSeverity.Info) => ProgressEvents.Add(new ServiceEvent(string.Intern(Name), message, DateTime.UtcNow, severity));
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
@@ -103,4 +103,4 @@ public enum ServiceState
|
||||
Paused
|
||||
}
|
||||
|
||||
public record ServiceEvent(string Source, string Message, DateTime Date, LogSeverity Severity);
|
||||
public record struct ServiceEvent(string Source, string Message, DateTime Date, LogSeverity Severity);
|
@@ -21,7 +21,7 @@ public class ClientService(IServiceScopeFactory scopeFactory, ILogger<ClientServ
|
||||
using var scope = scopeFactory.CreateScope();
|
||||
_libraryService = scope.ServiceProvider.GetRequiredService<ILibraryService>();
|
||||
LogEvent("Initializing service...");
|
||||
Pause();
|
||||
//Pause();
|
||||
}
|
||||
|
||||
protected override async Task ExecuteServiceAsync(CancellationToken stoppingToken)
|
||||
|
Reference in New Issue
Block a user