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["Value"] = "123";
parameter["token"] = _elevatorControlConfiguration.token;
while (!stoppingToken.IsCancellationRequested)
Task.Run(async () =>
{
await HttpClientHelper.GetAsync(_elevatorControlConfiguration.WriteTagUrl, parameter);
await Task.Delay(TimeSpan.FromMinutes(1));
}
while (!stoppingToken.IsCancellationRequested)
{
await HttpClientHelper.GetAsync(_elevatorControlConfiguration.WriteTagUrl, parameter);
await Task.Delay(TimeSpan.FromMinutes(1));
}
});
}
public override Task StopAsync(CancellationToken cancellationToken)

View File

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