|
|
@@ -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();
|