Agv心跳检测,包到线程中执行

This commit is contained in:
yang.lee
2023-10-11 10:03:36 +08:00
parent e671fd234d
commit 44c85d4e1e
2 changed files with 10 additions and 7 deletions

View File

@@ -33,11 +33,15 @@ namespace Tnb.WarehouseMgr
parameter["TagName"] = "AGVKeepalive"; parameter["TagName"] = "AGVKeepalive";
parameter["Value"] = "123"; parameter["Value"] = "123";
parameter["token"] = _elevatorControlConfiguration.token; parameter["token"] = _elevatorControlConfiguration.token;
while (!stoppingToken.IsCancellationRequested) Task.Run(async () =>
{ {
await HttpClientHelper.GetAsync(_elevatorControlConfiguration.WriteTagUrl, parameter); while (!stoppingToken.IsCancellationRequested)
await Task.Delay(TimeSpan.FromMinutes(1)); {
} await HttpClientHelper.GetAsync(_elevatorControlConfiguration.WriteTagUrl, parameter);
await Task.Delay(TimeSpan.FromMinutes(1));
}
});
} }
public override Task StopAsync(CancellationToken cancellationToken) public override Task StopAsync(CancellationToken cancellationToken)

View File

@@ -66,10 +66,9 @@ public class Startup : AppStartup
services.AddTaskMessageNotify(); services.AddTaskMessageNotify();
//定时任务 //定时任务
services.AddHostedService<TimedTaskBackgroundService>();
//Agv心跳监听服务
services.AddHostedService<AgvHeartbeatMonitorService>();
//services.AddHostedService<TimedTaskBackgroundService>(); //services.AddHostedService<TimedTaskBackgroundService>();
//Agv心跳监听服务
//services.AddHostedService<AgvHeartbeatMonitorService>();
} }