5 Commits
0.2.2 ... 0.2.3

Author SHA1 Message Date
f0cef81b5e Merge pull request #17 from ProfessorFartsalot/main
Some checks are pending
.NET Build and Publish to Gitea / build (push) Waiting to run
Fix health check, reconnect automatically on error
2025-09-05 06:12:43 +01:00
d8160effd0 Fix up client reconnect code
Simplified the reconnect code so that redis is made aware that we have a new connection.

Made the reconnect fire immediately on error rather than waiting for subsequent errors.
2025-09-04 21:50:47 -04:00
18da07763c Add in extra check to see if hub server DC'd 2025-09-04 18:41:44 -04:00
3c448f2290 Fix health check, reconnect automatically on error
+ Made health check actually do something instead of just logging connection health issues.

+ Requires server code change to enable the health check so it's not just returning false all the time.

+ Forcibly reconnects the client when they've had connection issues.
2025-09-04 17:18:26 -04:00
cadc7e223f minor fixes 2025-09-04 14:26:15 +01:00
3 changed files with 85 additions and 38 deletions

View File

@@ -129,7 +129,7 @@ public class DrawGroupPair : DrawPairBase
protected override float DrawRightSide(float textPosY, float originalY)
{
var pauseIcon = _fullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
var pauseIcon = _pair.IsPaused ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
var pauseIconSize = _uiSharedService.GetIconButtonSize(pauseIcon);
var spacingX = ImGui.GetStyle().ItemSpacing.X;
var entryUID = _fullInfoDto.UserAliasOrUID;
@@ -296,9 +296,10 @@ public class DrawGroupPair : DrawPairBase
if (_uiSharedService.IconButton(pauseIcon))
{
var perm = _fullInfoDto.GroupUserPermissions;
var newPaused = !perm.IsPaused();
perm.SetPaused(newPaused);
var perm = _pair.UserPair!.OwnPermissions;
perm.SetPaused(!perm.IsPaused());
_ = _apiController.UserSetPairPermissions(new(_pair.UserData, perm));
}
UiSharedService.AttachToolTip(!_fullInfoDto.GroupUserPermissions.IsPaused()

View File

@@ -183,6 +183,8 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
_connectionDto = await GetConnectionDto().ConfigureAwait(false);
await CheckClientHealth().ConfigureAwait(false);
ServerState = ServerState.Connected;
var currentClientVer = Assembly.GetExecutingAssembly().GetName().Version!;
@@ -308,14 +310,24 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
_ = Task.Run(async () => await StopConnection(ServerState.Disconnected).ConfigureAwait(false));
_connectionCancellationTokenSource?.Cancel();
}
private int _unhealthy = 0;
private async Task ClientHealthCheck(CancellationToken ct)
{
while (!ct.IsCancellationRequested && _mareHub != null)
{
await Task.Delay(TimeSpan.FromSeconds(30), ct).ConfigureAwait(false);
Logger.LogDebug("Checking Client Health State");
_ = await CheckClientHealth().ConfigureAwait(false);
var healthy = await CheckClientHealth().ConfigureAwait(false);
if (!healthy || _mareHub.State != HubConnectionState.Connected)
{
_unhealthy++;
if (_unhealthy > 0)
{
Logger.LogWarning("Health check failed, forcing reconnect. ClientHealth: {0} HubConnected: {1}", healthy, _mareHub.State != HubConnectionState.Connected);
await ForceResetConnection().ConfigureAwait(false);
_unhealthy = 0;
}
}
else _unhealthy = 0;
}
}
@@ -391,7 +403,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
{
var users = await GroupsGetUsersInGroup(group).ConfigureAwait(false);
foreach (var user in users)
{
{
Logger.LogDebug("Group Pair: {user}", user);
_pairManager.AddGroupPair(user);
}
@@ -478,5 +490,30 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
ServerState = state;
}
//Because this plugin really likes to bug out with connections, lets "fix" it....
public async Task ForceResetConnection()
{
if (!_initialized) return;
Logger.LogInformation("ForceReconnect called");
try
{
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
// Cancel any ongoing health checks to prevent conflicts
_healthCheckTokenSource?.Cancel();
_healthCheckTokenSource?.Dispose();
_healthCheckTokenSource = null;
await CreateConnections().ConfigureAwait(false);
Logger.LogInformation("ForceReconnect completed successfully");
}
catch (Exception ex)
{
Logger.LogError(ex, "Failure during ForceReconnect, disconnecting");
await StopConnection(ServerState.Disconnected).ConfigureAwait(false);
}
}
}
#pragma warning restore MA0040

View File

@@ -10,9 +10,9 @@
},
"DalamudPackager": {
"type": "Direct",
"requested": "[13.0.0, )",
"resolved": "13.0.0",
"contentHash": "Mb3cUDSK/vDPQ8gQIeuCw03EMYrej1B4J44a1AvIJ9C759p9XeqdU9Hg4WgOmlnlPe0G7ILTD32PKSUpkQNa8w=="
"requested": "[13.1.0, )",
"resolved": "13.1.0",
"contentHash": "XdoNhJGyFby5M/sdcRhnc5xTop9PHy+H50PTWpzLhJugjB19EDBiHD/AsiDF66RETM+0qKUdJBZrNuebn7qswQ=="
},
"DotNet.ReproducibleBuilds": {
"type": "Direct",
@@ -22,11 +22,11 @@
},
"Downloader": {
"type": "Direct",
"requested": "[3.3.4, )",
"resolved": "3.3.4",
"contentHash": "/M/c80e1L0WW1XrLSSiQhgFxk8rrfbpWiWDn2CeBg1tPD393Neo+v184yG/ThyhE9rrNp36yCrugiCmEbRf+VQ==",
"requested": "[4.0.3, )",
"resolved": "4.0.3",
"contentHash": "Vg1+UqPDstpMw2CKXV9XvB8jKHC95KQfbqPxQXvOMRMFnTov4Ixvvw6GZV5DXLnKuL2sfnmVYX9CaQtcURia1Q==",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "8.0.1"
"Microsoft.Extensions.Logging.Abstractions": "8.0.3"
}
},
"Glamourer.Api": {
@@ -55,11 +55,28 @@
"System.IO.Pipelines": "6.0.3"
}
},
"MessagePack": {
"type": "Direct",
"requested": "[3.1.4, )",
"resolved": "3.1.4",
"contentHash": "BH0wlHWmVoZpbAPyyt2Awbq30C+ZsS3eHSkYdnyUAbqVJ22fAJDzn2xTieBeoT5QlcBzp61vHcv878YJGfi3mg==",
"dependencies": {
"MessagePack.Annotations": "3.1.4",
"MessagePackAnalyzer": "3.1.4",
"Microsoft.NET.StringTools": "17.11.4"
}
},
"MessagePack.Annotations": {
"type": "Direct",
"requested": "[3.1.4, )",
"resolved": "3.1.4",
"contentHash": "aVWrDAkCdqxwQsz/q0ldPh2EFn48M99YUzE9OvZjMq2RNLKz4o2z88iGFvSvbMqOWRweRvKPHBJZe22PRqzslQ=="
},
"Meziantou.Analyzer": {
"type": "Direct",
"requested": "[2.0.212, )",
"resolved": "2.0.212",
"contentHash": "U91ktjjTRTccUs3Lk+hrLD9vW+2+lhnsOf4G1GpRSJi1pLn3uK5CU6wGP9Bmz1KlJs6Oz1GGoMhxQBoqQsmAuQ=="
"requested": "[2.0.213, )",
"resolved": "2.0.213",
"contentHash": "LHnFGBqhlBjbf8Uo4OIzGM0llRxFrIMuo/hP9oHq+aldS+28G4LqG12LK0co9b+S0yj1Vbf0rclDHN0Ji2DTkA=="
},
"Microsoft.AspNetCore.SignalR.Client": {
"type": "Direct",
@@ -133,6 +150,12 @@
"Microsoft.IdentityModel.Tokens": "8.14.0"
}
},
"System.IO.Pipelines": {
"type": "Direct",
"requested": "[9.0.8, )",
"resolved": "9.0.8",
"contentHash": "6vPmJt73mgUo1gzc/OcXlJvClz/2jxZ4TQPRfriVaLoGRH2mye530D9WHJYbFQRNMxF3PWCoeofsFdCyN7fLzA=="
},
"K4os.Compression.LZ4": {
"type": "Transitive",
"resolved": "1.3.8",
@@ -143,19 +166,10 @@
"resolved": "1.0.8",
"contentHash": "Wp2F7BamQ2Q/7Hk834nV9vRQapgcr8kgv9Jvfm8J3D0IhDqZMMl+a2yxUq5ltJitvXvQfB8W6K4F4fCbw/P6YQ=="
},
"MessagePack": {
"MessagePackAnalyzer": {
"type": "Transitive",
"resolved": "2.5.187",
"contentHash": "uW4j8m4Nc+2Mk5n6arOChavJ9bLjkis0qWASOj2h2OwmfINuzYv+mjCHUymrYhmyyKTu3N+ObtTXAY4uQ7jIhg==",
"dependencies": {
"MessagePack.Annotations": "2.5.187",
"Microsoft.NET.StringTools": "17.6.3"
}
},
"MessagePack.Annotations": {
"type": "Transitive",
"resolved": "2.5.198",
"contentHash": "3U9OvqQGTra+Mz1k1zfNAScSdNHobnqtQ51qdMGUZppkNDZJl0X/igq6Qz5zDBLEZoYqZrFtZwFx6wBJHHI8BA=="
"resolved": "3.1.4",
"contentHash": "CTaSsN/liJ7MhLCAB7Z4ZLBNuVGCq9lt2BT/cbrc9vzGv89yK3CqIA+z9T19a11eQYl9etZHL6MQJgCqECRVpg=="
},
"Microsoft.AspNetCore.Connections.Abstractions": {
"type": "Transitive",
@@ -499,19 +513,14 @@
},
"Microsoft.NET.StringTools": {
"type": "Transitive",
"resolved": "17.6.3",
"contentHash": "N0ZIanl1QCgvUumEL1laasU0a7sOE5ZwLZVTn0pAePnfhq8P7SvTjF8Axq+CnavuQkmdQpGNXQ1efZtu5kDFbA=="
"resolved": "17.11.4",
"contentHash": "mudqUHhNpeqIdJoUx2YDWZO/I9uEDYVowan89R6wsomfnUJQk6HteoQTlNjZDixhT2B4IXMkMtgZtoceIjLRmA=="
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
"resolved": "9.0.8",
"contentHash": "gebRF3JLLJ76jz1CQpvwezNapZUjFq20JQsaGHzBH0DzlkHBLpdhwkOei9usiOkIGMwU/L0ALWpNe1JE+5/itw=="
},
"System.IO.Pipelines": {
"type": "Transitive",
"resolved": "6.0.3",
"contentHash": "ryTgF+iFkpGZY1vRQhfCzX0xTdlV3pyaTTqRu2ETbEv+HlV7O6y7hyQURnghNIXvctl5DuZ//Dpks6HdL/Txgw=="
},
"System.Net.ServerSentEvents": {
"type": "Transitive",
"resolved": "9.0.8",
@@ -525,7 +534,7 @@
"maresynchronos.api": {
"type": "Project",
"dependencies": {
"MessagePack.Annotations": "[2.5.198, )"
"MessagePack.Annotations": "[2.5.129, )"
}
}
}