A bunch of additional logging in pursuit of #1713

This commit is contained in:
Jordan Dominion
2023-11-13 16:06:28 -05:00
parent ecd9acad80
commit ea49ec0da2
3 changed files with 22 additions and 4 deletions
+9 -1
View File
@@ -369,6 +369,8 @@ namespace Tgstation.Server.Host.Jobs
var hubUpdatesTask = Task.CompletedTask;
var result = false;
var firstLogHappened = false;
var hubGroupName = JobsHub.HubGroupName(job);
Stopwatch stopwatch = null;
void QueueHubUpdate(JobResponse update, bool final)
@@ -380,10 +382,16 @@ namespace Tgstation.Server.Host.Jobs
{
await currentUpdatesTask;
if (!firstLogHappened)
{
logger.LogTrace("Sending updates for job {id} to hub group {group}", update.Id.Value, hubGroupName);
firstLogHappened = true;
}
// DCT: Cancellation token is for job, operation should always run
await hub
.Clients
.Group(JobsHub.HubGroupName(job))
.Group(hubGroupName)
.ReceiveJobUpdate(update, CancellationToken.None);
}
@@ -117,6 +117,8 @@ namespace Tgstation.Server.Host.Jobs
{
ArgumentNullException.ThrowIfNull(authenticationContext);
logger.LogTrace("MapConnectionGroups UID: {uid}", authenticationContext.User.Id.Value);
List<long> permedInstanceIds = null;
await databaseContextFactory.UseContext(
async databaseContext =>
@@ -85,9 +85,17 @@ namespace Tgstation.Server.Host.Utils.SignalR
var mappingTask = OnConnectionMapGroups?.Invoke(
authenticationContext,
mappedGroups => Task.WhenAll(
mappedGroups.Select(
group => hub.Groups.AddToGroupAsync(context.ConnectionId, group, cancellationToken))),
mappedGroups =>
{
mappedGroups = mappedGroups.ToList();
logger.LogTrace(
"Mapping connection ID {connectionId} with groups: {mappedGroups}",
context.ConnectionId,
String.Join(", ", mappedGroups));
return Task.WhenAll(
mappedGroups.Select(
group => hub.Groups.AddToGroupAsync(context.ConnectionId, group, cancellationToken)));
},
cancellationToken)
?? ValueTask.CompletedTask;
userConnections.AddOrUpdate(