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