fly 9 months ago
parent
commit
06ff787fd2
1 changed files with 31 additions and 0 deletions
  1. 31 0
      URMAnalysis/Program.cs

+ 31 - 0
URMAnalysis/Program.cs

@@ -10,12 +10,43 @@ using static System.Net.Mime.MediaTypeNames;
 
 namespace URMAnalysis
 {
+
     internal class Program
     {
+        public static void WatchingVideoProcessor()
+        {
+            Task.Run(async () =>
+            {
+                try
+                {
+                    while (true)
+                    {
+                        await Task.Delay(TimeSpan.FromSeconds(30));
+
+                        for (int i = ImagePostProcess.VideoProcessorList.Count - 1; i >= 0; i--)
+                        {
+                            var item = ImagePostProcess.VideoProcessorList[i];
+                            if (item.LastActiveTime <= DateTime.UtcNow.AddMinutes(-5))
+                            {
+                                item.VideoProcessor.Dispose();
+                                ImagePostProcess.VideoProcessorList.Remove(item);
+                            }
+                        }
+                    }
+                }
+                catch (Exception e)
+                {
+                    Logger.WriteLineError($"AuthenticationService WatchingTokenQueueTask error:{e}");
+                }
+            });
+        }
+
+
         static void Main(string[] args)
         {
             //var argString = "URMAnalysis D:\\WingProjects\\HealthExam2024\\WingCloudServer\\src\\bin\\Debug\\net6.0\\URMTemp\\7614F4213C004BF396E27989C60DA34B D:\\WingProjects\\HealthExam2024\\WingCloudServer\\src\\bin\\Debug\\net6.0\\URMTemp\\7614F4213C004BF396E27989C60DA34B\\DA5D0DDEA6C24FC99A44078A495BE703.jpg D:\\WingProjects\\HealthExam2024\\WingCloudServer\\src\\bin\\Debug\\net6.0\\URMTemp\\7614F4213C004BF396E27989C60DA34B\\6D59286FC43C4E0592DA831D6D8657BD.dat;0;0;0;622;320;17200;0;1540;13;571.4;0;0;0;1;0.208949461704824;0.337662337662338;0;0;0;16;0;6;258;116;168;0;0;0.6;0;0.2;1;";
             //args = argString.Split(" ");
+            WatchingVideoProcessor();
             if (args != null && args.Length >= 1)
             {
                 var action = args[0];