2015-09-15 update 1 fix a bug that cause program not work when it running for at least one week

This commit is contained in:
parallelbgls@outlook.com
2015-09-15 15:24:54 +08:00
parent 7f9dd58580
commit 6f99bc5ce4

View File

@@ -377,7 +377,16 @@ namespace ModBus.Net
}
foreach (var machine in saveMachines)
{
await RunTask(machine);
try
{
CancellationTokenSource cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(30));
await RunTask(machine).WithCancellation(cts.Token);
}
catch
{
return;
}
}
}