Selaa lähdekoodia

😎修复自定义事件源异步问题

zuohuaijun 2 vuotta sitten
vanhempi
commit
bab72fc41d
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      Admin.NET/Admin.NET.Core/EventBus/RedisEventSourceStorer.cs

+ 4 - 1
Admin.NET/Admin.NET.Core/EventBus/RedisEventSourceStorer.cs

@@ -63,7 +63,10 @@ public sealed class RedisEventSourceStorer : IEventSourceStorer, IDisposable
             //var eventSource = JsonConvert.DeserializeObject<ChannelEventSource>(cr);
 
             // 写入内存管道存储器
-            _channel.Writer.WriteAsync(cr);
+            Task.Run(async () =>
+            {
+                await _channel.Writer.WriteAsync(cr);
+            });
         };
 
         // 启动消费者