mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
10.11.76
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.11.75</PluginVersion>
|
||||
<ProPluginVersion>10.11.75</ProPluginVersion>
|
||||
<DefaultVersion>10.11.75</DefaultVersion>
|
||||
<PluginVersion>10.11.76</PluginVersion>
|
||||
<ProPluginVersion>10.11.76</ProPluginVersion>
|
||||
<DefaultVersion>10.11.76</DefaultVersion>
|
||||
<AuthenticationVersion>10.11.6</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.11.6</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.20</NET8Version>
|
||||
|
@@ -145,6 +145,7 @@ public class TextFileLogger : ThingsGateway.NewLife.Log.TextFileLog, TouchSocket
|
||||
}
|
||||
WriteLog(logLevel, source, message, exception);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
cache.Remove(CacheKey);
|
||||
|
@@ -378,6 +378,8 @@ public abstract class DriverBase : AsyncDisposableObject, IDriver
|
||||
// 记录设备线程已停止的信息
|
||||
LogMessage?.LogInformation(string.Format(AppResource.DeviceTaskStop, DeviceName));
|
||||
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
|
||||
// 执行资源释放操作
|
||||
await this.SafeDisposeAsync().ConfigureAwait(false);
|
||||
|
||||
|
@@ -176,8 +176,8 @@ public class ChannelRuntimeService : IChannelRuntimeService
|
||||
if (restart)
|
||||
{
|
||||
await GlobalData.ChannelThreadManage.RestartChannelAsync(newChannelRuntimes).ConfigureAwait(false);
|
||||
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(_logger).ConfigureAwait(false);
|
||||
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a=> !newDeviceRuntimes.Contains(a)).ToArray(),_logger).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -209,7 +209,7 @@ public class ChannelRuntimeService : IChannelRuntimeService
|
||||
{
|
||||
await GlobalData.ChannelThreadManage.RestartChannelAsync(newChannelRuntimes).ConfigureAwait(false);
|
||||
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(_logger).ConfigureAwait(false);
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => !newDeviceRuntimes.Contains(a)).ToArray(),_logger).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -241,7 +241,7 @@ public class ChannelRuntimeService : IChannelRuntimeService
|
||||
{
|
||||
await GlobalData.ChannelThreadManage.RestartChannelAsync(newChannelRuntimes).ConfigureAwait(false);
|
||||
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(_logger).ConfigureAwait(false);
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => !newDeviceRuntimes.Contains(a)).ToArray(),_logger).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -205,7 +205,7 @@ public class DeviceRuntimeService : IDeviceRuntimeService
|
||||
if (restart)
|
||||
{
|
||||
await RuntimeServiceHelper.RestartDeviceAsync(newDeviceRuntimes).ConfigureAwait(false);
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(_logger).ConfigureAwait(false);
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => !newDeviceRuntimes.Contains(a)).ToArray(),_logger).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -239,7 +239,7 @@ internal static class RuntimeServiceHelper
|
||||
if (group.Key != null)
|
||||
await group.Key.RestartDeviceAsync(group.Value, false).ConfigureAwait(false);
|
||||
}
|
||||
foreach (var group in GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => a.Driver?.DeviceThreadManage != null).GroupBy(a => a.Driver.DeviceThreadManage))
|
||||
foreach (var group in GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a=>!newDeviceRuntimes.Contains(a)).Where(a => a.Driver?.DeviceThreadManage != null).GroupBy(a => a.Driver.DeviceThreadManage))
|
||||
{
|
||||
if (group.Key != null)
|
||||
await group.Key.RestartDeviceAsync(group.ToArray(), false).ConfigureAwait(false);
|
||||
@@ -260,7 +260,7 @@ internal static class RuntimeServiceHelper
|
||||
await group.Key.RemoveDeviceAsync(group.Value.Select(a => a.Id).ToArray()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
foreach (var group in GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => a.Driver?.DeviceThreadManage != null).GroupBy(a => a.Driver.DeviceThreadManage))
|
||||
foreach (var group in GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => !deviceRuntimes.Contains(a)).Where(a => a.Driver?.DeviceThreadManage != null).GroupBy(a => a.Driver.DeviceThreadManage))
|
||||
{
|
||||
if (group.Key != null)
|
||||
await group.Key.RestartDeviceAsync(group.ToArray(), false).ConfigureAwait(false);
|
||||
@@ -268,9 +268,9 @@ internal static class RuntimeServiceHelper
|
||||
|
||||
}
|
||||
|
||||
public static async Task ChangedDriverAsync(ILogger logger)
|
||||
public static async Task ChangedDriverAsync(DeviceRuntime[] channelDevice, ILogger logger)
|
||||
{
|
||||
var channelDevice = GlobalData.GetAllVariableBusinessDeviceRuntime();
|
||||
|
||||
|
||||
await channelDevice.ParallelForEachAsync(async (item, token) =>
|
||||
{
|
||||
|
@@ -398,22 +398,22 @@ public class VariableRuntimeService : IVariableRuntimeService
|
||||
//批量修改之后,需要重新加载通道
|
||||
RuntimeServiceHelper.Init(newChannelRuntimes);
|
||||
|
||||
{
|
||||
var newDeviceRuntimes = datas.Item2.AdaptListDeviceRuntime();
|
||||
|
||||
RuntimeServiceHelper.Init(newDeviceRuntimes);
|
||||
}
|
||||
{
|
||||
var newVariableRuntimes = datas.Item3.AdaptListVariableRuntime();
|
||||
RuntimeServiceHelper.Init(newVariableRuntimes);
|
||||
}
|
||||
var newDeviceRuntimes = datas.Item2.AdaptListDeviceRuntime();
|
||||
|
||||
RuntimeServiceHelper.Init(newDeviceRuntimes);
|
||||
|
||||
|
||||
var newVariableRuntimes = datas.Item3.AdaptListVariableRuntime();
|
||||
RuntimeServiceHelper.Init(newVariableRuntimes);
|
||||
|
||||
//根据条件重启通道线程
|
||||
|
||||
if (restart)
|
||||
{
|
||||
await GlobalData.ChannelThreadManage.RestartChannelAsync(newChannelRuntimes).ConfigureAwait(false);
|
||||
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(_logger).ConfigureAwait(false);
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => !newDeviceRuntimes.Contains(a)).ToArray(), _logger).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -437,22 +437,21 @@ public class VariableRuntimeService : IVariableRuntimeService
|
||||
//批量修改之后,需要重新加载通道
|
||||
RuntimeServiceHelper.Init(newChannelRuntimes);
|
||||
|
||||
{
|
||||
var newDeviceRuntimes = datas.Item2.AdaptListDeviceRuntime();
|
||||
|
||||
RuntimeServiceHelper.Init(newDeviceRuntimes);
|
||||
}
|
||||
{
|
||||
var newVariableRuntimes = datas.Item3.AdaptListVariableRuntime();
|
||||
RuntimeServiceHelper.Init(newVariableRuntimes);
|
||||
}
|
||||
var newDeviceRuntimes = datas.Item2.AdaptListDeviceRuntime();
|
||||
|
||||
RuntimeServiceHelper.Init(newDeviceRuntimes);
|
||||
|
||||
var newVariableRuntimes = datas.Item3.AdaptListVariableRuntime();
|
||||
RuntimeServiceHelper.Init(newVariableRuntimes);
|
||||
|
||||
//根据条件重启通道线程
|
||||
|
||||
if (restart)
|
||||
{
|
||||
await GlobalData.ChannelThreadManage.RestartChannelAsync(newChannelRuntimes).ConfigureAwait(false);
|
||||
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(_logger).ConfigureAwait(false);
|
||||
await RuntimeServiceHelper.ChangedDriverAsync(GlobalData.GetAllVariableBusinessDeviceRuntime().Where(a => !newDeviceRuntimes.Contains(a)).ToArray(), _logger).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user