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