fix 心跳间隔
This commit is contained in:
@@ -31,11 +31,14 @@ public class HeartbeatJob
|
||||
{
|
||||
var ipInfo = JsonConvert.DeserializeObject<IPPortDto>(device.ConnectionInfo);
|
||||
|
||||
await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port);
|
||||
//超时时间
|
||||
var CancellationTokenSource = new CancellationTokenSource(300);
|
||||
await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port, CancellationTokenSource.Token);
|
||||
|
||||
await _dbContext.Updateable<DeviceRegistryEntity>().SetColumns(x => x.LastHeartbeatTime == DateTime.Now)
|
||||
.Where(x => x.DeviceUniqueNo == device.UniqueNo).ExecuteCommandAsync();
|
||||
|
||||
_logger.LogInformation("心跳设备:{no}成功", device.UniqueNo);
|
||||
_logger.LogInformation("心跳设备成功:{no}", device.UniqueNo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ public class JobPack : BaseAppPack
|
||||
});
|
||||
|
||||
//心跳
|
||||
RecurringJob.AddOrUpdate<HeartbeatJob>("Heartbeat", s => s.RunAsync(), "10 * * * * ?", new RecurringJobOptions
|
||||
RecurringJob.AddOrUpdate<HeartbeatJob>("Heartbeat", s => s.RunAsync(), "0/10 * * * * ?", new RecurringJobOptions
|
||||
{
|
||||
TimeZone = TimeZoneInfo.Local
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user