Compare commits

...
Author SHA1 Message Date
adminandClaude Opus 4.5 62a70d7042 Add sequence number logging and duplicate detection
- Log UnfilteredResultCountAfter for each ActionResultResponse to help
  diagnose sync mismatches (gaps in sequence = messages never arrived)
- Add LogFlow sequence counter (#1, #2, #3...) to diagnose duplicate
  logging issue: if same seq# appears twice, two threads are processing
  same message; if seq# increments but lines appear doubled, it's a
  StreamWriter/Logger issue

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:04:18 -08:00
@@ -45,10 +45,16 @@ namespace eagle {
private readonly Logger _remoteEagleClientLogger = Logger.GetLogger("ConnectionLogger");
private readonly Logger _timingsLogger = Logger.GetLogger("ConnectionLogger");
// Counter to diagnose duplicate logging - if logs show same seq# twice, two threads
// are processing the same message. If seq# increments but lines appear doubled,
// it's a StreamWriter/Logger issue.
private int _logFlowSeq = 0;
/// <summary>Timestamped log for connection flow tracing.</summary>
private void LogFlow(string message) {
var seq = Interlocked.Increment(ref _logFlowSeq);
var ts = DateTime.UtcNow.ToString("HH:mm:ss.fff");
_remoteEagleClientLogger.LogLine($"[FLOW {ts}] {message}");
_remoteEagleClientLogger.LogLine($"[FLOW {ts}] #{seq} {message}");
}
private volatile bool _isConnecting = false;
@@ -763,8 +769,8 @@ namespace eagle {
? arResp.AvailableCommands.CommandsByProvince?.Count ?? 0
: 0;
var status = arResp.ServerGameStatus?.Status.ToString() ?? "null";
LogFlow($"UPDATE ActionResult game={gameUpdate.GameId} actionResults={arCount} " +
$"startingState={hasStartingState} hasCommands={hasCommands} " +
LogFlow($"UPDATE ActionResult game={gameUpdate.GameId} countAfter={arResp.UnfilteredResultCountAfter} " +
$"actionResults={arCount} startingState={hasStartingState} hasCommands={hasCommands} " +
$"token={cmdToken} cmdProvinces={cmdCount} status={status}");
// Update result counts IMMEDIATELY on the gRPC thread, before enqueueing.