jeson_fxd 1 день назад
Родитель
Сommit
ed1c55ac07
1 измененных файлов с 14 добавлено и 1 удалено
  1. 14 1
      server/src/server/OpenCards.Server.ArenaValor/ArenaManagerService.cs

+ 14 - 1
server/src/server/OpenCards.Server.ArenaValor/ArenaManagerService.cs

@@ -117,7 +117,20 @@ namespace OpenCards.Server.Arena
                 {
                     ServerUtils.StopServiceFunc?.Invoke(valorAddr.FullPath);
                 }
-                await this.Provider.CreateAsync(valorAddr, config);
+                // 这里不能直接CreateAsync,会与外层调用锁冲突产生死锁
+                var capturedConfig = new Dictionary<string, string>(config);
+                _ = Task.Run(async () =>
+                {
+                    try
+                    {
+                        await this.Provider.CreateAsync(valorAddr, capturedConfig);
+                        log.Warn($"ArenaValorService [{valorAddr}] created successfully (deferred)");
+                    }
+                    catch (Exception ex)
+                    {
+                        log.Error($"Failed to create ArenaValorService [{valorAddr}]: {ex}", ex);
+                    }
+                });
             }
 
             if (this.dataMapping.ArenaValorCurrentID >= 1)