fix heartbeat
This commit is contained in:
@@ -10,7 +10,6 @@ public class HeartbeatMonitorJob : IJob
|
||||
{
|
||||
var sp = (IServiceProvider)context.JobDetail.JobDataMap["ServiceProvider"];
|
||||
var gwSvc = sp.GetService<Igateway_nodesService>();
|
||||
var devSvc = sp.GetService<Ibase_deviceService>();
|
||||
|
||||
var timeout = DateTime.Now.AddSeconds(-30);
|
||||
var offlineNodes = await gwSvc.FindAsIQueryable(x => x.IsOnline == "在线" && x.LastHeartbeat < timeout)
|
||||
@@ -19,9 +18,7 @@ public class HeartbeatMonitorJob : IJob
|
||||
foreach (var node in offlineNodes)
|
||||
{
|
||||
node.IsOnline = "离线";
|
||||
gwSvc.Update(node);
|
||||
await devSvc.UpdateAsync(x => x.GatewayNodeId == node.NodeId,
|
||||
x => new base_device { IsOnline = "离线" });
|
||||
gwSvc.Add<object>(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user