mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 18:27:24 +01:00
more fixes
This commit is contained in:
parent
5233ce860b
commit
104cc53191
6 changed files with 38 additions and 14 deletions
|
|
@ -14,6 +14,7 @@ public sealed class MareMediator : IHostedService
|
|||
private readonly ConcurrentQueue<MessageBase> _messageQueue = new();
|
||||
private readonly PerformanceCollectorService _performanceCollector;
|
||||
private readonly Dictionary<Type, HashSet<SubscriberAction>> _subscriberDict = [];
|
||||
private bool _processQueue = false;
|
||||
|
||||
public MareMediator(ILogger<MareMediator> logger, PerformanceCollectorService performanceCollector)
|
||||
{
|
||||
|
|
@ -60,6 +61,11 @@ public sealed class MareMediator : IHostedService
|
|||
{
|
||||
while (!_loopCts.Token.IsCancellationRequested)
|
||||
{
|
||||
while (!_processQueue)
|
||||
{
|
||||
await Task.Delay(100, _loopCts.Token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await Task.Delay(100, _loopCts.Token).ConfigureAwait(false);
|
||||
|
||||
HashSet<MessageBase> processedMessages = [];
|
||||
|
|
@ -167,6 +173,12 @@ public sealed class MareMediator : IHostedService
|
|||
}
|
||||
}
|
||||
|
||||
public void StartQueueProcessing()
|
||||
{
|
||||
_logger.LogInformation("Starting Message Queue Processing");
|
||||
_processQueue = true;
|
||||
}
|
||||
|
||||
private sealed class SubscriberAction
|
||||
{
|
||||
public SubscriberAction(IMediatorSubscriber subscriber, object action)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue