コード例 #1
0
        private string BuildTimeoutDiagnosticInfo(JournalEntry beforeWaitAny, TimeSpan?timeout, long?lastWaitEntryId, long?lastActionEntryId)
        {
            var info = new StringBuilder();

            info.AppendLine(timeout.HasValue ? $"Journal WaitAny timeout after {timeout.Value}" : "Journal WaitAny timeout after unspecified TimeSpan");
            if (lastWaitEntryId.HasValue)
            {
                info.AppendLine($"Jurnal's LastWaitEntryId is {lastWaitEntryId.Value}");
            }
            if (lastActionEntryId.HasValue)
            {
                info.AppendLine($"Journal source's LastActionEntryId is {lastActionEntryId.Value}");
            }

            if (beforeWaitAny != null)
            {
                info.AppendLine("Last journal entry before wait:");
                info.AppendLine(beforeWaitAny.ToString());

                var entriesAfterWait = journalSource?
                                       .Where(x => x.Id > beforeWaitAny.Id).ToArray();
                if (entriesAfterWait != null && entriesAfterWait.Any())
                {
                    info.AppendLine("Journal entries after wait:");
                    foreach (var entry in entriesAfterWait)
                    {
                        info.AppendLine(entry.ToString());
                    }
                }
                else
                {
                    info.AppendLine("No journal entries after wait.");
                }
            }
            else
            {
                info.AppendLine("No entry before wait");
            }

            return(info.ToString());
        }
コード例 #2
0
 public IEnumerator <JournalEntry> GetEnumerator()
 {
     return(source.Where(line => line.Id >= journalEntryStartId).GetEnumerator());
 }