Shun %!s(int64=2) %!d(string=hai) anos
pai
achega
1c80dc7ccb

+ 1 - 1
src/YSAI.Core/YSAI.Core.csproj

@@ -3,7 +3,7 @@
     <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
-    <Version>23.331.36455</Version>
+    <Version>23.331.38048</Version>
     <PackageOutputPath Condition="'$(Configuration)' == 'Release'">../YSAI.Publish/Release</PackageOutputPath>
     <PackageOutputPath Condition="'$(Configuration)' == 'Debug'">../YSAI.Publish/Debug</PackageOutputPath>
     <Authors>Shun</Authors>

+ 6 - 6
src/YSAI.Core/relay/RelayOperate.cs

@@ -214,7 +214,7 @@ namespace YSAI.Core.relay
                 {
                     OnEventHandler(this, new EventResult(false, $"配置文件不存在"));
                 }
-            }, tokenSource?.Token ?? CancellationToken.None);
+            });
         }
 
         /// <summary>
@@ -247,11 +247,11 @@ namespace YSAI.Core.relay
         /// 监控任务
         /// </summary>
         /// <returns></returns>
-        public Task WatcherTask()
+        public Task WatcherTask(CancellationTokenSource tokenSource)
         {
             return Task.Factory.StartNew(() =>
             {
-                while (!WatcherToken.IsCancellationRequested)
+                while (!tokenSource.IsCancellationRequested)
                 {
                     //队列数据
                     WatcherData? watcherData;
@@ -428,7 +428,7 @@ namespace YSAI.Core.relay
                     }
                     Thread.Sleep(1000);
                 }
-            }, WatcherToken.Token);
+            }, tokenSource.Token);
         }
 
         /// <summary>
@@ -443,7 +443,7 @@ namespace YSAI.Core.relay
             {
                 WatcherQueue = new ConcurrentQueue<WatcherData>();
                 WatcherToken = new CancellationTokenSource();
-                WatcherTask();
+                WatcherTask(WatcherToken);
             }
 
             WatcherQueue.Enqueue(new WatcherData { e = e, Type = Type, WType = WatcherData.WatcherType.Deleted });
@@ -461,7 +461,7 @@ namespace YSAI.Core.relay
             {
                 WatcherQueue = new ConcurrentQueue<WatcherData>();
                 WatcherToken = new CancellationTokenSource();
-                WatcherTask();
+                WatcherTask(WatcherToken);
             }
 
             WatcherQueue.Enqueue(new WatcherData { e = e, Type = Type, WType = WatcherData.WatcherType.Created });

+ 1 - 1
src/YSAI.Test.All/Program.cs

@@ -142,7 +142,7 @@ for (int i = 0; i < strings.Count; i++)
                             }
                         }
                     },
-                    RSn = "YSAI.Test.Dll.TestAll[Instance][R1]"
+                    RSn = "YSAI.Test.Dll.TestAll[Instance][R2]"
                 }
             }
         });