KIM-JINO5 hace 2 meses
padre
commit
13b9f23fb2
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. 7 0
      Web.Api/Program.cs

+ 7 - 0
Web.Api/Program.cs

@@ -77,4 +77,11 @@ app.MapEndpoints();
 app.MapHub<CryptoHub>("/hubs/crypto");
 app.MapHub<ChatHub>("/hubs/chat");
 
+// 서버 시작 시 이전 채팅 접속자 정보 초기화 (stale 연결 제거)
+using (var scope = app.Services.CreateScope())
+{
+    var redis = scope.ServiceProvider.GetRequiredService<StackExchange.Redis.IConnectionMultiplexer>();
+    redis.GetDatabase().KeyDelete(Application.Abstractions.Cache.CacheKeys.ChatConnections);
+}
+
 app.Run();