Back to warning fixing!

This commit is contained in:
cake
2025-11-18 00:38:43 +01:00
parent bfaa583808
commit a68e9e996b
2 changed files with 43 additions and 20 deletions

View File

@@ -294,8 +294,9 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
bytesRead = await readTask.ConfigureAwait(false); bytesRead = await readTask.ConfigureAwait(false);
} }
catch (OperationCanceledException) catch (OperationCanceledException ex)
{ {
Logger.LogWarning(ex, "Request got cancelled : {url}", requestUrl);
throw; throw;
} }

View File

@@ -29,7 +29,6 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
private readonly DalamudUtilService _dalamudUtil; private readonly DalamudUtilService _dalamudUtil;
private readonly HubFactory _hubFactory; private readonly HubFactory _hubFactory;
private readonly PairManager _pairManager; private readonly PairManager _pairManager;
private readonly PairRequestService _pairRequestService;
private readonly ServerConfigurationManager _serverManager; private readonly ServerConfigurationManager _serverManager;
private readonly TokenProvider _tokenProvider; private readonly TokenProvider _tokenProvider;
private readonly LightlessConfigService _lightlessConfigService; private readonly LightlessConfigService _lightlessConfigService;
@@ -44,13 +43,12 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
private CensusUpdateMessage? _lastCensus; private CensusUpdateMessage? _lastCensus;
public ApiController(ILogger<ApiController> logger, HubFactory hubFactory, DalamudUtilService dalamudUtil, public ApiController(ILogger<ApiController> logger, HubFactory hubFactory, DalamudUtilService dalamudUtil,
PairManager pairManager, PairRequestService pairRequestService, ServerConfigurationManager serverManager, LightlessMediator mediator, PairManager pairManager, ServerConfigurationManager serverManager, LightlessMediator mediator,
TokenProvider tokenProvider, LightlessConfigService lightlessConfigService, NotificationService lightlessNotificationService) : base(logger, mediator) TokenProvider tokenProvider, LightlessConfigService lightlessConfigService, NotificationService lightlessNotificationService) : base(logger, mediator)
{ {
_hubFactory = hubFactory; _hubFactory = hubFactory;
_dalamudUtil = dalamudUtil; _dalamudUtil = dalamudUtil;
_pairManager = pairManager; _pairManager = pairManager;
_pairRequestService = pairRequestService;
_serverManager = serverManager; _serverManager = serverManager;
_tokenProvider = tokenProvider; _tokenProvider = tokenProvider;
_lightlessConfigService = lightlessConfigService; _lightlessConfigService = lightlessConfigService;
@@ -133,7 +131,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogInformation("Not recreating Connection, paused"); Logger.LogInformation("Not recreating Connection, paused");
_connectionDto = null; _connectionDto = null;
await StopConnectionAsync(ServerState.Disconnected).ConfigureAwait(false); await StopConnectionAsync(ServerState.Disconnected).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return; return;
} }
@@ -147,7 +148,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Lightless.", Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Lightless.",
NotificationType.Error)); NotificationType.Error));
await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false); await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return; return;
} }
@@ -156,7 +160,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogWarning("No secret key set for current character"); Logger.LogWarning("No secret key set for current character");
_connectionDto = null; _connectionDto = null;
await StopConnectionAsync(ServerState.NoSecretKey).ConfigureAwait(false); await StopConnectionAsync(ServerState.NoSecretKey).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return; return;
} }
} }
@@ -170,7 +177,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Lightless.", Mediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Delete the duplicates in the character management to be able to connect to Lightless.",
NotificationType.Error)); NotificationType.Error));
await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false); await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return; return;
} }
@@ -179,7 +189,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogWarning("No UID/OAuth set for current character"); Logger.LogWarning("No UID/OAuth set for current character");
_connectionDto = null; _connectionDto = null;
await StopConnectionAsync(ServerState.OAuthMisconfigured).ConfigureAwait(false); await StopConnectionAsync(ServerState.OAuthMisconfigured).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return; return;
} }
@@ -188,7 +201,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogWarning("OAuth2 login token could not be updated"); Logger.LogWarning("OAuth2 login token could not be updated");
_connectionDto = null; _connectionDto = null;
await StopConnectionAsync(ServerState.OAuthLoginTokenStale).ConfigureAwait(false); await StopConnectionAsync(ServerState.OAuthLoginTokenStale).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return; return;
} }
} }
@@ -199,7 +215,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational, Mediator.Publish(new EventMessage(new Services.Events.Event(nameof(ApiController), Services.Events.EventSeverity.Informational,
$"Starting Connection to {_serverManager.CurrentServer.ServerName}"))); $"Starting Connection to {_serverManager.CurrentServer.ServerName}")));
_connectionCancellationTokenSource?.Cancel(); if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
_connectionCancellationTokenSource?.Dispose(); _connectionCancellationTokenSource?.Dispose();
_connectionCancellationTokenSource = new CancellationTokenSource(); _connectionCancellationTokenSource = new CancellationTokenSource();
var token = _connectionCancellationTokenSource.Token; var token = _connectionCancellationTokenSource.Token;
@@ -598,7 +617,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
$"Stopping existing connection to {_serverManager.CurrentServer.ServerName}"))); $"Stopping existing connection to {_serverManager.CurrentServer.ServerName}")));
_initialized = false; _initialized = false;
_healthCheckTokenSource?.Cancel(); if (_healthCheckTokenSource != null)
{
await _healthCheckTokenSource.CancelAsync().ConfigureAwait(false);
}
Mediator.Publish(new DisconnectedMessage()); Mediator.Publish(new DisconnectedMessage());
_lightlessHub = null; _lightlessHub = null;
_connectionDto = null; _connectionDto = null;
@@ -609,42 +631,42 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
public Task<UserProfileDto?> UserGetLightfinderProfile(string hashedCid) public Task<UserProfileDto?> UserGetLightfinderProfile(string hashedCid)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task UpdateChatPresence(ChatPresenceUpdateDto presence) public Task UpdateChatPresence(ChatPresenceUpdateDto presence)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task Client_ChatReceive(ChatMessageDto message) public Task Client_ChatReceive(ChatMessageDto message)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task<IReadOnlyList<ZoneChatChannelInfoDto>> GetZoneChatChannels() public Task<IReadOnlyList<ZoneChatChannelInfoDto>> GetZoneChatChannels()
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task<IReadOnlyList<GroupChatChannelInfoDto>> GetGroupChatChannels() public Task<IReadOnlyList<GroupChatChannelInfoDto>> GetGroupChatChannels()
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task SendChatMessage(ChatSendRequestDto request) public Task SendChatMessage(ChatSendRequestDto request)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task ReportChatMessage(ChatReportSubmitDto request) public Task ReportChatMessage(ChatReportSubmitDto request)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
public Task<ChatParticipantResolveResultDto?> ResolveChatParticipant(ChatParticipantResolveRequestDto request) public Task<ChatParticipantResolveResultDto?> ResolveChatParticipant(ChatParticipantResolveRequestDto request)
{ {
throw new NotImplementedException(); throw new NotSupportedException();
} }
} }
#pragma warning restore MA0040 #pragma warning restore MA0040