This commit is contained in:
azyges
2025-10-29 07:50:41 +09:00
parent ee69df8081
commit dceaceb941
14 changed files with 3108 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
using LightlessSync.API.Data;
using LightlessSync.API.Data.Enum;
using LightlessSync.API.Dto;
using LightlessSync.API.Dto.Chat;
using LightlessSync.API.SignalR;
using LightlessSyncServer.Services;
using LightlessSyncServer.Configuration;
@@ -16,6 +17,8 @@ using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using StackExchange.Redis.Extensions.Core.Abstractions;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace LightlessSyncServer.Hubs;
@@ -43,6 +46,7 @@ public partial class LightlessHub : Hub<ILightlessHub>, ILightlessHub
private LightlessDbContext DbContext => _dbContextLazy.Value;
private readonly int _maxCharaDataByUser;
private readonly int _maxCharaDataByUserVanity;
private readonly ChatChannelService _chatChannelService;
private CancellationToken RequestAbortedToken => _contextAccessor.HttpContext?.RequestAborted ?? Context?.ConnectionAborted ?? CancellationToken.None;
@@ -50,7 +54,8 @@ public partial class LightlessHub : Hub<ILightlessHub>, ILightlessHub
IDbContextFactory<LightlessDbContext> lightlessDbContextFactory, ILogger<LightlessHub> logger, SystemInfoService systemInfoService,
IConfigurationService<ServerConfiguration> configuration, IHttpContextAccessor contextAccessor,
IRedisDatabase redisDb, OnlineSyncedPairCacheService onlineSyncedPairCacheService, LightlessCensus lightlessCensus,
GPoseLobbyDistributionService gPoseLobbyDistributionService, IBroadcastConfiguration broadcastConfiguration, PairService pairService)
GPoseLobbyDistributionService gPoseLobbyDistributionService, IBroadcastConfiguration broadcastConfiguration, PairService pairService,
ChatChannelService chatChannelService)
{
_lightlessMetrics = lightlessMetrics;
_systemInfoService = systemInfoService;
@@ -71,6 +76,7 @@ public partial class LightlessHub : Hub<ILightlessHub>, ILightlessHub
_dbContextLazy = new Lazy<LightlessDbContext>(() => lightlessDbContextFactory.CreateDbContext());
_broadcastConfiguration = broadcastConfiguration;
_pairService = pairService;
_chatChannelService = chatChannelService;
}
protected override void Dispose(bool disposing)
@@ -221,6 +227,7 @@ public partial class LightlessHub : Hub<ILightlessHub>, ILightlessHub
catch { }
finally
{
_chatChannelService.RemovePresence(UserUID);
_userConnections.Remove(UserUID, out _);
}
}