/// <summary> /// If the client feeding from the queue goes haywire, we start to log details about it for debug purposes. /// </summary> private static void DocumentSuspectMessageRequests(string consoleId, int lastKnownChangeNumber, GetMessagesResult result, List <ConsoleMessageQueueElement> messageQueueElements) { int maxSecondsExpected = 60; if (lastKnownChangeNumber > result.CurrentSequenceNumber) { LoggingService.LogInformation("ConsoleMessageServiceFacade", string.Format("Console '{0}' has a last known change numer of {1}, but server current number is {2}.", consoleId, lastKnownChangeNumber, result.CurrentSequenceNumber)); } if (messageQueueElements.Any() && DateTime.Now.Subtract(messageQueueElements.Min(f => f.EnqueueTime)).TotalSeconds > maxSecondsExpected) { ConsoleMessageQueueFacade.DoDebugSerializationToFileSystem(); LoggingService.LogWarning("ConsoleMessageServiceFacade", string.Format("Console '{0}' are requesting messages that are more than {1} seconds old. Console has last known change number {2}, server is now at {3}. Debug XML dump saved at '{4}'.", consoleId, maxSecondsExpected, lastKnownChangeNumber, result.CurrentSequenceNumber, GlobalSettingsFacade.TempDirectory)); } }