🦭feat: 增加最大并发数常量

This commit is contained in:
喵你个旺呀 2025-05-14 23:18:48 +08:00
parent 3a39a1da9b
commit 0d5bb9f82c
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,11 @@ public class CommonConst
/// 日志分组名称
/// </summary>
public const string SysLogCategoryName = "System.Logging.LoggingMonitor";
/// <summary>
/// 最大并发数
/// </summary>
public const int MaxConcurrent = 8;
/// <summary>
/// 事件-增加异常日志

View File

@ -391,7 +391,7 @@ public static class SqlSugarSetup
else
entityTypes = entityTypes.Where(u => u.GetCustomAttribute<TenantAttribute>()?.configId.ToString() == config.ConfigId.ToString()).ToList(); // 自定义的库
var semaphore = new SemaphoreSlim(8); // 并发限制数量
var semaphore = new SemaphoreSlim(CommonConst.MaxConcurrent); // 并发限制数量
int taskIndex = 0, size = entityTypes.Count;
var taskList = entityTypes.Select(entityType => Task.Run(() =>
{
@ -525,7 +525,8 @@ public static class SqlSugarSetup
.WhereIF(config.SeedSettings.EnableIncreSeed, u => u.IsDefined(typeof(IncreSeedAttribute), false))
.OrderBy(u => u.GetCustomAttributes(typeof(SeedDataAttribute), false).Length > 0 ? ((SeedDataAttribute)u.GetCustomAttributes(typeof(SeedDataAttribute), false)[0]).Order : 0).ToList();
var semaphore = new SemaphoreSlim(8); // 并发限制数量
var semaphore = new SemaphoreSlim(CommonConst.MaxConcurrent); // 并发限制数量
int taskIndex = 0, size = seedDataTypes.Count;
var taskList = seedDataTypes.Select(seedType => Task.Run(() =>
{