mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
fix: opcua插件订阅检查失效
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.8.7</PluginVersion>
|
||||
<ProPluginVersion>10.8.7</ProPluginVersion>
|
||||
<PluginVersion>10.8.8</PluginVersion>
|
||||
<ProPluginVersion>10.8.8</ProPluginVersion>
|
||||
<AuthenticationVersion>2.8.0</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.8.2</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.17</NET8Version>
|
||||
|
@@ -108,17 +108,23 @@ public class OpcUaMaster : CollectBase
|
||||
|
||||
var check = ScheduledTaskHelper.GetTask("3000", CheckAsync, null, LogMessage, cancellationToken);
|
||||
list.Add(check);
|
||||
var checkConnec = ScheduledTaskHelper.GetTask("3000", CheckConnectAsync, null, LogMessage, cancellationToken);
|
||||
var checkConnec = ScheduledTaskHelper.GetTask("10000", CheckConnectAsync, null, LogMessage, cancellationToken);
|
||||
list.Add(checkConnec);
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override async Task ProtectedStartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await CheckConnectAsync(null, cancellationToken).ConfigureAwait(false);
|
||||
await base.ProtectedStartAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task CheckConnectAsync(object? state, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_plc.Session == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(100, cancellationToken).ConfigureAwait(false);
|
||||
if (_plc.Session == null)
|
||||
await _plc.ConnectAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@@ -129,13 +135,12 @@ public class OpcUaMaster : CollectBase
|
||||
|
||||
connectFirstFailLoged = true;
|
||||
CurrentDevice.SetDeviceStatus(TimerX.Now, true, ex.Message);
|
||||
await Task.Delay(10000, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async Task CheckAsync(object? state, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_plc.Session == null)
|
||||
if (_plc.Session != null)
|
||||
{
|
||||
if (_driverProperties.ActiveSubscribe)
|
||||
{
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>10.8.7</Version>
|
||||
<Version>10.8.8</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user