From dadd246f05f649d99abbb09d843cf138038449ef Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 2 Jul 2024 16:22:49 +0800 Subject: [PATCH] =?UTF-8?q?remove=20=E7=A7=BB=E9=99=A4=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E5=8F=91=E8=B5=B7=E5=BF=83=E8=B7=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Dlhis.ScheduledTask/Jobs/HeartbeatJob.cs | 86 ++++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/Jobs/HeartbeatJob.cs b/Src/Dlhis.ScheduledTask/Jobs/HeartbeatJob.cs index c2cef7a0..e6e0619d 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/HeartbeatJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/HeartbeatJob.cs @@ -1,43 +1,43 @@ -using System.Net; -using System.Net.Sockets; -using Dlhis.Entity.Basic.Entity; -using Dlhis.Entity.Device.Entities; -using Dlhis.ScheduledTask.Attributes; -using Kurisu.AspNetCore.CustomClass; -using Newtonsoft.Json; - -namespace Dlhis.ScheduledTask.Jobs; - -/// -/// 设备心跳 -/// -[RecurringJob(nameof(HeartbeatJob), "0/30 * * * * ?", Name = "设备心跳")] -public class HeartbeatJob : BaseJob -{ - public HeartbeatJob(IServiceProvider serviceProvider) : base(serviceProvider) - { - } - - protected override async Task RunAsync(IServiceProvider serviceProvider) - { - var devices = await DbContext.Queryable().Where(x => x.Enable).Where(x => x.HeartbeatInterval > 0).ToListAsync(); - - await Parallel.ForEachAsync(devices, async (device, cancellationToken) => - { - try - { - var ipInfo = JsonConvert.DeserializeObject(device.ConnectionInfo); - await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port, cancellationToken); - - await DbContext.Updateable() - .SetColumns(x => x.LastHeartbeatTime == DateTime.Now) - .Where(x => x.DeviceUniqueNo == device.UniqueNo) - .ExecuteCommandAsync(cancellationToken); - } - catch (Exception) - { - //ignore - } - }); - } -} \ No newline at end of file +// using System.Net; +// using System.Net.Sockets; +// using Dlhis.Entity.Basic.Entity; +// using Dlhis.Entity.Device.Entities; +// using Dlhis.ScheduledTask.Attributes; +// using Kurisu.AspNetCore.CustomClass; +// using Newtonsoft.Json; +// +// namespace Dlhis.ScheduledTask.Jobs; +// +// /// +// /// 设备心跳 +// /// +// [RecurringJob(nameof(HeartbeatJob), "0/30 * * * * ?", Name = "设备心跳")] +// public class HeartbeatJob : BaseJob +// { +// public HeartbeatJob(IServiceProvider serviceProvider) : base(serviceProvider) +// { +// } +// +// protected override async Task RunAsync(IServiceProvider serviceProvider) +// { +// var devices = await DbContext.Queryable().Where(x => x.Enable).Where(x => x.HeartbeatInterval > 0).ToListAsync(); +// +// await Parallel.ForEachAsync(devices, async (device, cancellationToken) => +// { +// try +// { +// var ipInfo = JsonConvert.DeserializeObject(device.ConnectionInfo); +// await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port, cancellationToken); +// +// await DbContext.Updateable() +// .SetColumns(x => x.LastHeartbeatTime == DateTime.Now) +// .Where(x => x.DeviceUniqueNo == device.UniqueNo) +// .ExecuteCommandAsync(cancellationToken); +// } +// catch (Exception) +// { +// //ignore +// } +// }); +// } +// } \ No newline at end of file