Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -44,9 +44,10 @@ namespace Tnb.WarehouseMgr
|
||||
static TimedTaskBackgroundService()
|
||||
{
|
||||
_timedFuncMap = App.EffectiveTypes.AsParallel().Where(t => !t.Namespace.IsNullOrWhiteSpace() && t.Namespace.Contains("Tnb.WarehouseMgr")).SelectMany(t => t.GetMethods())
|
||||
.Where(m => m.GetCustomAttribute<TimedAttribute>() != null)
|
||||
.ToDictionary(x => x.Name, x =>
|
||||
(Func<CancellationTokenSource?, Task>)Delegate.CreateDelegate(typeof(Func<CancellationTokenSource?, Task>), App.GetService(x.DeclaringType), x));
|
||||
.Where(m => m.GetCustomAttribute<TimedAttribute>() != null)
|
||||
.ToDictionary(x => x.Name, x =>
|
||||
(Func<CancellationTokenSource?, Task>)Delegate.CreateDelegate(typeof(Func<CancellationTokenSource?, Task>), App.GetService(x.DeclaringType), x));
|
||||
|
||||
}
|
||||
public TimedTaskBackgroundService(IServiceProvider serviceProvider)
|
||||
{
|
||||
@@ -59,7 +60,7 @@ namespace Tnb.WarehouseMgr
|
||||
var channelReader = _serviceProvider.GetRequiredService<ITaskMessageNotify>().Reader;
|
||||
|
||||
CancellationTokenSource? cts = new();
|
||||
|
||||
|
||||
while (channelReader != null && await channelReader.WaitToReadAsync())
|
||||
{
|
||||
while (channelReader.TryRead(out var message))
|
||||
|
||||
Reference in New Issue
Block a user