Parcourir la source

同2D监控数据采集分开

林豪 左 il y a 2 ans
Parent
commit
0070b54465
1 fichiers modifiés avec 32 ajouts et 32 suppressions
  1. 32 32
      Projects/永冠OPP/WCS.Service/ProtocolProxy.cs

+ 32 - 32
Projects/永冠OPP/WCS.Service/ProtocolProxy.cs

@@ -94,7 +94,7 @@ namespace WCS.Service
         //static ConcurrentQueue<PackInfo> Packs = new ConcurrentQueue<PackInfo>();
         private static Dictionary<string, Playerback> Clients = new Dictionary<string, Playerback>();
 
-        private static RedisClient Redis;
+        //private static RedisClient Redis;
 
         public static RedisClient LiaotcRedis;
 
@@ -106,21 +106,21 @@ namespace WCS.Service
             MessagePackSerializer.DefaultOptions = StandardResolver.Options.WithCompression(MessagePackCompression.Lz4Block);
             //Redis = new RedisClient("192.168.249.120,password=123456,database=11");
 
-            #region 公用云服务器
+            //#region 公用云服务器
 
-            Redis = new RedisClient("212.64.66.35,database=10");
-            Redis.Serialize = obj =>
-            {
-                var bytes = MessagePackSerializer.Serialize(obj);
-                return bytes;
-            };
-            Redis.DeserializeRaw = (bytes, type) =>
-            {
-                var obj = MessagePackSerializer.Deserialize(type, bytes);
-                return obj;
-            };
+            //Redis = new RedisClient("212.64.66.35,database=10");
+            //Redis.Serialize = obj =>
+            //{
+            //    var bytes = MessagePackSerializer.Serialize(obj);
+            //    return bytes;
+            //};
+            //Redis.DeserializeRaw = (bytes, type) =>
+            //{
+            //    var obj = MessagePackSerializer.Deserialize(type, bytes);
+            //    return obj;
+            //};
 
-            #endregion 公用云服务器
+            //#endregion 公用云服务器
 
             #region 私用云服务器
 
@@ -237,13 +237,13 @@ namespace WCS.Service
                     p.SetValue(pack, coll);
                 }
 
-                var sw = new Stopwatch();
-                sw.Start();
-                Redis.Set(nameof(DeviceDataPack), pack);
-                sw.Stop();
-                Console.ForegroundColor = ConsoleColor.Blue;
-                Console.WriteLine($"Redis耗时{sw.ElapsedMilliseconds}");
-                Console.ResetColor();
+                //var sw = new Stopwatch();
+                //sw.Start();
+                //Redis.Set(nameof(DeviceDataPack), pack);
+                //sw.Stop();
+                //Console.ForegroundColor = ConsoleColor.Blue;
+                //Console.WriteLine($"Redis耗时{sw.ElapsedMilliseconds}");
+                //Console.ResetColor();
 
                 var se = new Stopwatch();
                 se.Start();
@@ -261,13 +261,13 @@ namespace WCS.Service
                 Console.WriteLine($"LiaotcRedis耗时{sr.ElapsedMilliseconds}");
                 Console.ResetColor();
                 /////
-                var st = new Stopwatch();
-                st.Start();
-                Redis.RPush("Packs", pack);
-                st.Stop();
-                Console.ForegroundColor = ConsoleColor.Blue;
-                Console.WriteLine($"Redis耗时{st.ElapsedMilliseconds}");
-                Console.ResetColor();
+                //var st = new Stopwatch();
+                //st.Start();
+                //Redis.RPush("Packs", pack);
+                //st.Stop();
+                //Console.ForegroundColor = ConsoleColor.Blue;
+                //Console.WriteLine($"Redis耗时{st.ElapsedMilliseconds}");
+                //Console.ResetColor();
 
                 var sy = new Stopwatch();
                 sy.Start();
@@ -289,10 +289,10 @@ namespace WCS.Service
                 //YGWCS150Redis.RPush("Packs", pack);
                 //LiaotcRedis.RPush("Packs", pack);
 
-                if (Redis.LLen("Packs") > 100000)
-                {
-                    Redis.LTrim("Packs", 5000, -1);
-                }
+                //if (Redis.LLen("Packs") > 100000)
+                //{
+                //    Redis.LTrim("Packs", 5000, -1);
+                //}
 
                 if (YGWCS150Redis.LLen("Packs") > 200000)
                 {