Compare commits
No commits in common. "c1bd5e6cfbe445ad93e0e542815809acad97d9b9" and "3178b031e4763ff4ee6342c82c247ea477215d57" have entirely different histories.
c1bd5e6cfb
...
3178b031e4
|
|
@ -11,6 +11,4 @@ public interface IMgSessionService<TSessionItem> where TSessionItem : IMgSession
|
||||||
public bool TryGetSessionItem(string sessionId, out TSessionItem sessionItem);
|
public bool TryGetSessionItem(string sessionId, out TSessionItem sessionItem);
|
||||||
public bool TryRemoveSessionItem(string sessionId, out TSessionItem sessionItem);
|
public bool TryRemoveSessionItem(string sessionId, out TSessionItem sessionItem);
|
||||||
public int Count();
|
public int Count();
|
||||||
|
|
||||||
bool TryGetSessionItemBySignlaRConnectionId(string signalRConnectionId, out TSessionItem? sessionItem);
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
using Microsoft.Extensions.Hosting;
|
|
||||||
using Nop.Services.Logging;
|
|
||||||
|
|
||||||
namespace Mango.Nop.Services;
|
|
||||||
|
|
||||||
public abstract class MgBackgroundServiceBase(ILogger logger, IServiceProvider service) : BackgroundService
|
|
||||||
{
|
|
||||||
protected abstract Task OnExecuteAsync();
|
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
||||||
{
|
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await logger.InformationAsync($"MgBackgroundServiceBase.ExecuteAsync(); Processing ExecuteAsync");
|
|
||||||
await OnExecuteAsync();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
await logger.ErrorAsync($"MgBackgroundServiceBase.ExecuteAsync(); Failure while processing ExecuteAsync", ex, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task StartAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await logger.InformationAsync("MgBackgroundServiceBase.ExecuteAsync(); Starting MgBackgroundServiceBase");
|
|
||||||
await base.StartAsync(cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task StopAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
await logger.InformationAsync("MgBackgroundServiceBase.StopAsync(); Stopping MgBackgroundServiceBase");
|
|
||||||
await base.StopAsync(cancellationToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -37,10 +37,4 @@ public abstract class MgSessionService<TSessionItem> : IMgSessionService<TSessio
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count() => Sessions.Count;
|
public int Count() => Sessions.Count;
|
||||||
|
|
||||||
public bool TryGetSessionItemBySignlaRConnectionId(string signalRConnectionId, out TSessionItem? sessionItem)
|
|
||||||
{
|
|
||||||
sessionItem = Sessions.Values.FirstOrDefault(x => x.SignaRConnectionId == signalRConnectionId);
|
|
||||||
return sessionItem != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue