|
@@ -87,21 +87,22 @@ public class ServerMessageJob : IJob
|
|
|
{
|
|
|
// Console.WriteLine(string.Format("Now:{0} commandList Count:{1} ", DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss"), commandList.Count));
|
|
|
}
|
|
|
- await Parallel.ForEachAsync(cmdMachineList, async (charger_SN, token) => //{ });
|
|
|
+
|
|
|
+ Dictionary<WsClientData, List<ServerMessage>> toSendWsClientDataMsgPair =
|
|
|
+ commandList
|
|
|
+ .GroupBy(x => x.ChargeBoxId)
|
|
|
+ .Where(x => clientDic.ContainsKey(x.Key))
|
|
|
+ .ToDictionary(x => clientDic[x.Key], x => x.ToList());
|
|
|
+
|
|
|
+ await Parallel.ForEachAsync(toSendWsClientDataMsgPair, async (sendPair, token) => //{ });
|
|
|
//foreach (var charger_SN in cmdMachineList)
|
|
|
{
|
|
|
- WsClientData session;
|
|
|
+ WsClientData session = sendPair.Key;
|
|
|
+ string charger_SN = session.ChargeBoxId;
|
|
|
string uuid = string.Empty;
|
|
|
|
|
|
- if (!clientDic.TryGetValue(charger_SN, out session))
|
|
|
- {
|
|
|
- //continue;
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
//logger.LogDebug(string.Format("charger_SN:{0} startDt:{1} CreatedOn:{2}", charger_SN, startDt.ToString("yyyy/MM/dd HH:mm:ss"), DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss")));
|
|
|
|
|
|
- //if (session.IsCheckIn && !session.ISOCPP20)
|
|
|
if (session.ISOCPP20)
|
|
|
{
|
|
|
//continue;
|
|
@@ -110,7 +111,7 @@ public class ServerMessageJob : IJob
|
|
|
|
|
|
string rawRequest = string.Empty;
|
|
|
|
|
|
- var cmdList = commandList.Where(c => c.ChargeBoxId == charger_SN).ToList();
|
|
|
+ List<ServerMessage> cmdList = sendPair.Value;
|
|
|
|
|
|
var profiles = protalServer.Profiles;
|
|
|
|