Skip to content

IsTimeout check is not platform independent #35

@petr-pokorny-absa

Description

@petr-pokorny-absa

In the StatementClientV1 there's the following code checking the timeout:

public bool IsTimeout
        {
            get => Session.Properties.Timeout.HasValue
                && Session.Properties.Timeout.Value.Ticks > 0
                && stopwatch.ElapsedTicks > Session.Properties.Timeout.Value.Ticks;
        }

It is not correct as Stopwatch ticks resolution is based on Stopwatch.Frequency, which is platform dependent. From the doc:

Stopwatch ticks are different from DateTime.Ticks. Each tick in the DateTime.Ticks value represents one 100-nanosecond interval. Each tick in the ElapsedTicks value represents the time interval equal to 1 second divided by the Frequency.

E.g. on M1 Macbook Stopwatch.Frequency is 1_000_000_000 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions