diff --git a/Service/Charger/ChargerService.cs b/Service/Charger/ChargerService.cs index 358a509..4a132e7 100644 --- a/Service/Charger/ChargerService.cs +++ b/Service/Charger/ChargerService.cs @@ -1,4 +1,5 @@ -using Entity.DbModel.Station; +using System.Collections.Concurrent; +using Entity.DbModel.Station; using Entity.Dto.Resp; using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Entity; @@ -81,7 +82,7 @@ public class ChargerService /// public Result DistributeElecPriceForCharge(int version) { - Dictionary chargerClients = ClientMgr.Dictionary; + ConcurrentDictionary chargerClients = ClientMgr.Dictionary; if (chargerClients.Values.Count <= 0) { return Result.Fail(); diff --git a/Service/Charger/Client/ClientMgr.cs b/Service/Charger/Client/ClientMgr.cs index 416e5cd..2db3e51 100644 --- a/Service/Charger/Client/ClientMgr.cs +++ b/Service/Charger/Client/ClientMgr.cs @@ -1,4 +1,5 @@ -using Autofac; +using System.Collections.Concurrent; +using Autofac; using Common.Const; using DotNetty.Transport.Channels; using Entity.DbModel.Station; @@ -19,7 +20,7 @@ public static class ClientMgr { private static readonly ILog Log = LogManager.GetLogger(typeof(ClientMgr)); - public static readonly Dictionary Dictionary = new(); + public static readonly ConcurrentDictionary Dictionary = new(); private static bool AutoChargeWorking { get; set; }