adjust logging and change faulty states

This commit is contained in:
Stanley Dimant
2022-10-09 15:30:43 +02:00
parent 3272dbe040
commit d49ee21d01
2 changed files with 7 additions and 5 deletions

View File

@@ -141,7 +141,11 @@ public class GrpcClientIdentificationService : IHostedService
{ {
while (!ct.IsCancellationRequested) while (!ct.IsCancellationRequested)
{ {
await CheckFaultStateAndResend().ConfigureAwait(false); try
{
await CheckFaultStateAndResend().ConfigureAwait(false);
}
catch { SetGrpcFaulty(); }
await Task.Delay(250).ConfigureAwait(false); await Task.Delay(250).ConfigureAwait(false);
} }
} }
@@ -272,9 +276,6 @@ public class GrpcClientIdentificationService : IHostedService
{ {
if (_grpcIsFaulty) if (_grpcIsFaulty)
{ {
_grpcIsFaulty = false;
_logger.LogInformation("GRPC connection is restored, sending current server idents");
await RestartStreams().ConfigureAwait(false); await RestartStreams().ConfigureAwait(false);
var msg = new ServerIdentMessage(); var msg = new ServerIdentMessage();
msg.Idents.AddRange(OnlineClients.Select(c => new SetIdentMessage() msg.Idents.AddRange(OnlineClients.Select(c => new SetIdentMessage()
@@ -282,6 +283,8 @@ public class GrpcClientIdentificationService : IHostedService
UidWithIdent = c.Value UidWithIdent = c.Value
})); }));
await _grpcIdentClient.RecreateServerIdentsAsync(msg).ConfigureAwait(false); await _grpcIdentClient.RecreateServerIdentsAsync(msg).ConfigureAwait(false);
_logger.LogInformation("GRPC connection is restored");
_grpcIsFaulty = false;
} }
} }

View File

@@ -111,7 +111,6 @@ internal class IdentityService : IdentificationService.IdentificationServiceBase
await responseStream.WriteAsync(cur).ConfigureAwait(false); await responseStream.WriteAsync(cur).ConfigureAwait(false);
} }
_logger.LogInformation("Queue for " + server + " is empty: " + (identChanges.ContainsKey(server) ? identChanges[server].IsEmpty : true));
await Task.Delay(10).ConfigureAwait(false); await Task.Delay(10).ConfigureAwait(false);
} }
} }