Skip to content

Timestamp occasionally out-of-sequence #190

@colinangusmackay

Description

@colinangusmackay

In rare cases when many logs are created in multiple threads the timestamps and sequence numbers can become out of order. Each should only ever increase, and ordering a set of log entries by sequence should produce the same sequence as ordering by timestamp.

This fix, ensures that timestamps are only ever increasing. The resolution of the DateTime.UtcNow function is system dependent, so can be between 0.5ms to 15ms, or 5000 to 150,000 ticks (at 10,000 ticks per millisecond). So, in some scenarios, multiple log entries can be created before the DateTime.UtcNow method produces a new value. In this event a new DateTime is produces that increments the Ticks by 1 to ensure that the value is distinct from the preceding log entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions