镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Don't turn a sub-second TimeSpan command timeout into no timeout - #39655

Open
ilkertskn wants to merge 1 commit into
dotnet:mainfrom
ilkertskn:fix/command-timeout-sub-second-timespan
Open

ilkertskn wants to merge 1 commit into
dotnet:mainfrom
ilkertskn:fix/command-timeout-sub-second-timespan

Conversation

@ilkertskn

Copy link
Copy Markdown
Contributor

SetCommandTimeout(TimeSpan) and UseCommandTimeout(TimeSpan) converted the timeout with Convert.ToInt32(timeout.TotalSeconds), which rounds anything up to half a second (inclusive, banker's rounding) to 0. A command timeout of 0 means "wait indefinitely", so asking for a 400 ms timeout removed the timeout altogether.

Round a positive timeout that would become 0 up to 1 second, and share the TimeSpan validation between the two overloads.

  • [x ] I've read the guidelines for contributing and seen the walkthrough
  • [ x] I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • [ x] The code builds and tests pass locally (also verified by our automated build checks)
  • [x ] Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • [ x] Tests for the changes have been added (for bug fixes / features)
  • [ x] Code follows the same patterns and style as existing code in this repo

SetCommandTimeout(TimeSpan) and UseCommandTimeout(TimeSpan) converted the
timeout with Convert.ToInt32(timeout.TotalSeconds), which rounds anything
up to half a second (inclusive, banker's rounding) to 0. A command timeout
of 0 means "wait indefinitely", so asking for a 400 ms timeout removed the
timeout altogether.

Round a positive timeout that would become 0 up to 1 second, and share
the TimeSpan validation between the two overloads.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant