fix 数据过滤调整
This commit is contained in:
@@ -25,7 +25,7 @@ public class HeartbeatJob : BaseJob
|
||||
|
||||
public override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
{
|
||||
var key = "heardbeat-devices";
|
||||
const string key = "heartbeat-devices";
|
||||
await _redisCache.KeyDeleteAsync(key);
|
||||
|
||||
var devices = await DbContext.Queryable<DeviceEntity>().Where(x => x.Enable).Where(x => x.HeartbeatInterval > 0).ToListAsync();
|
||||
@@ -36,11 +36,11 @@ public class HeartbeatJob : BaseJob
|
||||
var ipInfo = JsonConvert.DeserializeObject<IPPortDto>(device.ConnectionInfo);
|
||||
|
||||
//超时时间
|
||||
var CancellationTokenSource = new CancellationTokenSource(300);
|
||||
await new TcpClient().ConnectAsync(IPAddress.Parse(ipInfo.IP), ipInfo.Port, CancellationTokenSource.Token);
|
||||
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();
|
||||
.Where(x => x.DeviceUniqueNo == device.UniqueNo).ExecuteCommandAsync(cancellationTokenSource.Token);
|
||||
|
||||
await _redisCache.ListLeftPushAsync(key, device.UniqueNo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user