build: 10.9.24

This commit is contained in:
Diego
2025-07-08 09:41:45 +08:00
parent 0779efc5dd
commit 46b16279c7
3 changed files with 8 additions and 59 deletions

View File

@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<PluginVersion>10.9.23</PluginVersion>
<ProPluginVersion>10.9.23</ProPluginVersion>
<DefaultVersion>10.9.23</DefaultVersion>
<PluginVersion>10.9.24</PluginVersion>
<ProPluginVersion>10.9.24</ProPluginVersion>
<DefaultVersion>10.9.24</DefaultVersion>
<AuthenticationVersion>2.9.13</AuthenticationVersion>
<SourceGeneratorVersion>10.9.13</SourceGeneratorVersion>
<NET8Version>8.0.17</NET8Version>

View File

@@ -60,7 +60,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
{
// 默认批量数量
const int defaultSize = 10000;
const int highMemorySize = 50000;
const int highMemorySize = 100000;
const long memoryThreshold = 2L * 1024 * 1024; // 2GB单位KB
return GlobalData.HardwareJob.HardwareInfo.MachineInfo.AvailableMemory > memoryThreshold
@@ -72,8 +72,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
/// </summary>
private async Task DoMasterWork(object? state, CancellationToken stoppingToken)
{
// 延迟一段时间,避免过于频繁地执行任务
await Task.Delay(500, stoppingToken).ConfigureAwait(false);
try
{
bool online = false;
@@ -132,8 +131,6 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
/// </summary>
private async Task DoSlaveWork(object? state, CancellationToken stoppingToken)
{
// 延迟一段时间,避免过于频繁地执行任务
await Task.Delay(5000, stoppingToken).ConfigureAwait(false);
try
{
bool online = false;
@@ -288,11 +285,11 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
LogMessage?.LogInformation($"Redundancy task started");
if (RedundancyOptions.IsMaster)
{
scheduledTask = new ScheduledAsyncTask(10, DoMasterWork, null, null, cancellationToken);
scheduledTask = new ScheduledAsyncTask(RedundancyOptions.SyncInterval, DoMasterWork, null, null, cancellationToken);
}
else
{
scheduledTask = new ScheduledAsyncTask(10, DoSlaveWork, null, null, cancellationToken);
scheduledTask = new ScheduledAsyncTask(5000, DoSlaveWork, null, null, cancellationToken);
}
scheduledTask.Start();
@@ -371,28 +368,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
.SetTick(TimeSpan.FromMilliseconds(redundancy.HeartbeatInterval))
.SetMaxFailCount(redundancy.MaxErrorCount);
//使用重连
a.UseDmtpReconnection<TcpDmtpClient>()
.UsePolling(TimeSpan.FromSeconds(3))//使用轮询每3秒检测一次
.SetActionForCheck(async (c, i) =>//重新定义检活策略
{
//方法2直接ping如果true则客户端必在线。如果false则客户端不一定不在线原因是可能当前传输正在忙
if (await c.PingAsync().ConfigureAwait(false))
{
return true;
}
//返回false时可以判断如果最近活动时间不超过3秒则猜测客户端确实在忙所以跳过本次重连
else if (DateTime.Now - c.GetLastActiveTime() < TimeSpan.FromSeconds(3))
{
return null;
}
//否则,直接重连。
else
{
return false;
}
});
});
@@ -437,7 +413,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable
{
FeedbackType = FeedbackType.WaitInvoke,
Token = cancellationToken,
Timeout = 30000,
Timeout = 1800000,
SerializationType = SerializationType.Json,
};
}

View File

@@ -325,33 +325,6 @@ internal sealed class UpdateZipFileHostedService : BackgroundService, IUpdateZip
a.Add<FilePlugin>();
//使用重连
a.UseDmtpReconnection<TcpDmtpClient>()
.UsePolling(TimeSpan.FromSeconds(3))//使用轮询每3秒检测一次
.SetActionForCheck(async (c, i) =>//重新定义检活策略
{
if (!upgradeServerOptions.Enable) return true;
//方法1直接判断是否在握手状态。使用该方式最好和心跳插件配合使用。因为如果直接断网则检测不出来
//await Task.CompletedTask;//消除Task
//return c.Online;//判断是否在握手状态
//方法2直接ping如果true则客户端必在线。如果false则客户端不一定不在线原因是可能当前传输正在忙
if (await c.PingAsync().ConfigureAwait(false))
{
return true;
}
//返回false时可以判断如果最近活动时间不超过3秒则猜测客户端确实在忙所以跳过本次重连
else if (DateTime.Now - c.GetLastActiveTime() < TimeSpan.FromSeconds(3))
{
return null;
}
//否则,直接重连。
else
{
return false;
}
});
a.UseDmtpHeartbeat()//使用Dmtp心跳
.SetTick(TimeSpan.FromSeconds(5))
.SetMaxFailCount(3);