mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-11-03 00:53:59 +08:00
10.8.7
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.8.6</PluginVersion>
|
||||
<ProPluginVersion>10.8.6</ProPluginVersion>
|
||||
<PluginVersion>10.8.7</PluginVersion>
|
||||
<ProPluginVersion>10.8.7</ProPluginVersion>
|
||||
<AuthenticationVersion>2.8.0</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.8.2</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.17</NET8Version>
|
||||
|
||||
@@ -549,7 +549,7 @@ public abstract class DeviceBase : DisposableObject, IDevice
|
||||
Channel.ChannelReceivedWaitDict.TryAdd(sign, ChannelReceived);
|
||||
var sendOperResult = await SendAsync(command, clientChannel, endPoint, cancellationToken).ConfigureAwait(false);
|
||||
if (!sendOperResult.IsSuccess)
|
||||
throw sendOperResult.Exception ?? new(sendOperResult.ErrorMessage);
|
||||
throw sendOperResult.Exception ?? new(sendOperResult.ErrorMessage ?? "unknown error");
|
||||
|
||||
await waitData.WaitAsync(timeout).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ThingsGateway.Gateway.Application
|
||||
{
|
||||
public interface IScheduledIntIntervalTask
|
||||
{
|
||||
int IntervalMS { get; }
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using TouchSocket.Core;
|
||||
|
||||
namespace ThingsGateway.Gateway.Application;
|
||||
|
||||
public class ScheduledAsyncTask : DisposeBase, IScheduledTask
|
||||
public class ScheduledAsyncTask : DisposeBase, IScheduledTask, IScheduledIntIntervalTask
|
||||
{
|
||||
private int _interval10MS = 10;
|
||||
private int _intervalMS;
|
||||
public int IntervalMS { get; }
|
||||
private readonly Func<object?, CancellationToken, Task> _taskFunc;
|
||||
private readonly CancellationToken _token;
|
||||
private TimerX? _timer;
|
||||
@@ -19,7 +19,7 @@ public class ScheduledAsyncTask : DisposeBase, IScheduledTask
|
||||
|
||||
public ScheduledAsyncTask(int interval, Func<object?, CancellationToken, Task> taskFunc, object? state, ILog log, CancellationToken token)
|
||||
{
|
||||
_intervalMS = interval;
|
||||
IntervalMS = interval;
|
||||
LogMessage = log;
|
||||
_state = state;
|
||||
_taskFunc = taskFunc;
|
||||
@@ -30,7 +30,7 @@ public class ScheduledAsyncTask : DisposeBase, IScheduledTask
|
||||
{
|
||||
_timer?.Dispose();
|
||||
if (!_token.IsCancellationRequested)
|
||||
_timer = new TimerX(DoAsync, _state, _intervalMS, _intervalMS, nameof(IScheduledTask)) { Async = true };
|
||||
_timer = new TimerX(DoAsync, _state, IntervalMS, IntervalMS, nameof(IScheduledTask)) { Async = true };
|
||||
}
|
||||
|
||||
private async Task DoAsync(object? state)
|
||||
@@ -78,6 +78,7 @@ public class ScheduledAsyncTask : DisposeBase, IScheduledTask
|
||||
_timer?.SetNext(_interval10MS);
|
||||
}
|
||||
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_timer?.Dispose();
|
||||
|
||||
@@ -5,10 +5,10 @@ using TouchSocket.Core;
|
||||
|
||||
namespace ThingsGateway.Gateway.Application;
|
||||
|
||||
public class ScheduledSyncTask : DisposeBase, IScheduledTask
|
||||
public class ScheduledSyncTask : DisposeBase, IScheduledTask, IScheduledIntIntervalTask
|
||||
{
|
||||
private int _interval10MS = 10;
|
||||
private int _intervalMS;
|
||||
public int IntervalMS { get; }
|
||||
private readonly Action<object?, CancellationToken> _taskAction;
|
||||
private readonly CancellationToken _token;
|
||||
private TimerX? _timer;
|
||||
@@ -19,7 +19,7 @@ public class ScheduledSyncTask : DisposeBase, IScheduledTask
|
||||
|
||||
public ScheduledSyncTask(int interval, Action<object?, CancellationToken> taskFunc, object? state, ILog log, CancellationToken token)
|
||||
{
|
||||
_intervalMS = interval;
|
||||
IntervalMS = interval;
|
||||
LogMessage = log;
|
||||
_state = state;
|
||||
_taskAction = taskFunc;
|
||||
@@ -30,7 +30,7 @@ public class ScheduledSyncTask : DisposeBase, IScheduledTask
|
||||
{
|
||||
_timer?.Dispose();
|
||||
if (!_token.IsCancellationRequested)
|
||||
_timer = new TimerX(TimerCallback, _state, _intervalMS, _intervalMS, nameof(IScheduledTask)) { Async = true };
|
||||
_timer = new TimerX(TimerCallback, _state, IntervalMS, IntervalMS, nameof(IScheduledTask)) { Async = true };
|
||||
}
|
||||
|
||||
private void TimerCallback(object? state)
|
||||
@@ -82,13 +82,6 @@ public class ScheduledSyncTask : DisposeBase, IScheduledTask
|
||||
_timer?.SetNext(_interval10MS);
|
||||
}
|
||||
|
||||
public void Change(int dueTime, int period)
|
||||
{
|
||||
_intervalMS = period;
|
||||
if (!_token.IsCancellationRequested)
|
||||
_timer?.Change(dueTime, period);
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_timer?.Dispose();
|
||||
|
||||
@@ -12,6 +12,7 @@ public class TaskSchedulerLoop
|
||||
{
|
||||
return Tasks.Count;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
foreach (var task in Tasks)
|
||||
|
||||
@@ -40,12 +40,6 @@ public abstract class CollectPropertyBase : DriverPropertyBase
|
||||
/// </summary>
|
||||
public abstract class CollectPropertyRetryBase : CollectPropertyBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 离线后恢复运行的间隔时间
|
||||
/// </summary>
|
||||
[DynamicProperty]
|
||||
public override int ReIntervalTime { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 失败重试次数,默认3
|
||||
/// </summary>
|
||||
|
||||
@@ -298,11 +298,9 @@
|
||||
},
|
||||
"ThingsGateway.Gateway.Application.CollectPropertyBase": {
|
||||
"ConcurrentCount": "ConcurrentCount",
|
||||
"ReIntervalTime": "ReIntervalTime",
|
||||
"RetryCount": "RetryCount"
|
||||
},
|
||||
"ThingsGateway.Gateway.Application.CollectPropertyRetryBase": {
|
||||
"ReIntervalTime": "ReIntervalTime",
|
||||
"RetryCount": "RetryCount"
|
||||
},
|
||||
"ThingsGateway.Gateway.Application.ControlController": {
|
||||
|
||||
@@ -297,11 +297,9 @@
|
||||
},
|
||||
"ThingsGateway.Gateway.Application.CollectPropertyBase": {
|
||||
"ConcurrentCount": "最大并发数量",
|
||||
"ReIntervalTime": "离线恢复时间",
|
||||
"RetryCount": "失败重试次数"
|
||||
},
|
||||
"ThingsGateway.Gateway.Application.CollectPropertyRetryBase": {
|
||||
"ReIntervalTime": "离线恢复时间",
|
||||
"RetryCount": "失败重试次数"
|
||||
},
|
||||
"ThingsGateway.Gateway.Application.ControlController": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>10.8.6</Version>
|
||||
<Version>10.8.7</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user