fix 并发线程数由系统处理
This commit is contained in:
@@ -219,7 +219,7 @@ public class DevicePermissionService : IDevicePermissionService
|
|||||||
var waitAddTasks = new ConcurrentBag<DeviceTaskEntity>();
|
var waitAddTasks = new ConcurrentBag<DeviceTaskEntity>();
|
||||||
var waitDeleteTasks = new ConcurrentBag<DeviceTaskEntity>();
|
var waitDeleteTasks = new ConcurrentBag<DeviceTaskEntity>();
|
||||||
|
|
||||||
Parallel.ForEach(userNos, new ParallelOptions { MaxDegreeOfParallelism = 100 }, userNo =>
|
Parallel.ForEach(userNos, userNo =>
|
||||||
{
|
{
|
||||||
before.TryGetValue(userNo, out var beforeTenantDeviceCodes);
|
before.TryGetValue(userNo, out var beforeTenantDeviceCodes);
|
||||||
beforeTenantDeviceCodes ??= new List<UserTenantDeviceCodeDto>();
|
beforeTenantDeviceCodes ??= new List<UserTenantDeviceCodeDto>();
|
||||||
@@ -622,11 +622,7 @@ public class DevicePermissionService : IDevicePermissionService
|
|||||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||||
|
|
||||||
var result = new ConcurrentDictionary<string, List<UserTenantDeviceCodeDto>>();
|
var result = new ConcurrentDictionary<string, List<UserTenantDeviceCodeDto>>();
|
||||||
var parallelOptions = new ParallelOptions
|
Parallel.ForEach(gainfos, gainfo =>
|
||||||
{
|
|
||||||
MaxDegreeOfParallelism = 100,
|
|
||||||
};
|
|
||||||
Parallel.ForEach(gainfos, parallelOptions, gainfo =>
|
|
||||||
{
|
{
|
||||||
var gainfoDto = new GainfoDto
|
var gainfoDto = new GainfoDto
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user