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);
}
catch (OperationCanceledException)
catch (OperationCanceledException ex)
{
Logger.LogWarning(ex, "Request got cancelled : {url}", requestUrl);
throw;
}

View File

@@ -29,7 +29,6 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
private readonly DalamudUtilService _dalamudUtil;
private readonly HubFactory _hubFactory;
private readonly PairManager _pairManager;
private readonly PairRequestService _pairRequestService;
private readonly ServerConfigurationManager _serverManager;
private readonly TokenProvider _tokenProvider;
private readonly LightlessConfigService _lightlessConfigService;
@@ -44,13 +43,12 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
private CensusUpdateMessage? _lastCensus;
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)
{
_hubFactory = hubFactory;
_dalamudUtil = dalamudUtil;
_pairManager = pairManager;
_pairRequestService = pairRequestService;
_serverManager = serverManager;
_tokenProvider = tokenProvider;
_lightlessConfigService = lightlessConfigService;
@@ -133,7 +131,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogInformation("Not recreating Connection, paused");
_connectionDto = null;
await StopConnectionAsync(ServerState.Disconnected).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
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.",
NotificationType.Error));
await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return;
}
@@ -156,7 +160,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogWarning("No secret key set for current character");
_connectionDto = null;
await StopConnectionAsync(ServerState.NoSecretKey).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
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.",
NotificationType.Error));
await StopConnectionAsync(ServerState.MultiChara).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return;
}
@@ -179,7 +189,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogWarning("No UID/OAuth set for current character");
_connectionDto = null;
await StopConnectionAsync(ServerState.OAuthMisconfigured).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
return;
}
@@ -188,7 +201,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
Logger.LogWarning("OAuth2 login token could not be updated");
_connectionDto = null;
await StopConnectionAsync(ServerState.OAuthLoginTokenStale).ConfigureAwait(false);
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
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,
$"Starting Connection to {_serverManager.CurrentServer.ServerName}")));
_connectionCancellationTokenSource?.Cancel();
if (_connectionCancellationTokenSource != null)
{
await _connectionCancellationTokenSource.CancelAsync().ConfigureAwait(false);
}
_connectionCancellationTokenSource?.Dispose();
_connectionCancellationTokenSource = new CancellationTokenSource();
var token = _connectionCancellationTokenSource.Token;
@@ -598,7 +617,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
$"Stopping existing connection to {_serverManager.CurrentServer.ServerName}")));
_initialized = false;
_healthCheckTokenSource?.Cancel();
if (_healthCheckTokenSource != null)
{
await _healthCheckTokenSource.CancelAsync().ConfigureAwait(false);
}
Mediator.Publish(new DisconnectedMessage());
_lightlessHub = null;
_connectionDto = null;
@@ -609,42 +631,42 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IL
public Task<UserProfileDto?> UserGetLightfinderProfile(string hashedCid)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task UpdateChatPresence(ChatPresenceUpdateDto presence)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task Client_ChatReceive(ChatMessageDto message)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task<IReadOnlyList<ZoneChatChannelInfoDto>> GetZoneChatChannels()
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task<IReadOnlyList<GroupChatChannelInfoDto>> GetGroupChatChannels()
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task SendChatMessage(ChatSendRequestDto request)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task ReportChatMessage(ChatReportSubmitDto request)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
public Task<ChatParticipantResolveResultDto?> ResolveChatParticipant(ChatParticipantResolveRequestDto request)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
#pragma warning restore MA0040