This commit is contained in:
alex
2023-08-04 11:27:37 +08:00
parent cf23a50ee9
commit 6ad92877b9
3 changed files with 3 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ namespace Tnb.WarehouseMgr
/// 定时任务
/// added by ly on 20230802
/// </summary>
public class TimedTaskBackgroundService : IHostedService
public class TimedTaskBackgroundService : BackgroundService
{
private ISendMessageService? _sendService;

View File

@@ -217,7 +217,7 @@ namespace Tnb.WarehouseMgr
[HttpPost]
public async Task GenTaskExecute(CancellationTokenSource? cts = default)
{
Stopwatch sw = Stopwatch.StartNew();
var db = _db.CopyNew();
try

View File

@@ -64,9 +64,7 @@ public class Startup : AppStartup
services.AddOverideVisualDev();
//定时任务
//services.AddHostedService<TimedTaskBackgroundService>();
//services.AddSingleton<TimedTaskBackgroundService>();
//services.AddHostedService(sp => new ConditionalBackgroundService(sp.GetRequiredService<TimedTaskBackgroundService>()));
services.AddHostedService<TimedTaskBackgroundService>();
}