fix(sdk): honor explicit zero poll_interval_ms and poll_timeout_ms - #278
Open
Tyagiquamar wants to merge 1 commit into
Open
Tyagiquamar wants to merge 1 commit into
Tyagiquamar wants to merge 1 commit into
Conversation
The poll helpers resolved options with 'or', so poll_interval_ms=0 fell back to the default delay and poll_timeout_ms=0 disabled the timeout entirely. poll()/poll_async() also skipped the timeout check for timeout_seconds=0. Use is_given() against the NotGiven sentinel and compare timeouts against None instead.
Author
|
Hi, just following up on this when you get a chance. The branch is up to date and checks are green. If it looks good from your side, it should be ready to merge. Happy to make any changes if needed. Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hand-written poll helpers (stores, stores.files, parsing.jobs, sync and async) resolved their options with boolean-or: poll_interval_ms or 500/1000 and poll_timeout_ms or None, then guarded the timeout conversion with 'if polling_timeout_ms'. Since 0 is falsy, poll_interval_ms=0 silently fell back to the default delay and poll_timeout_ms=0 silently disabled the timeout. polling.poll/poll_async had the same flaw with 'if timeout_seconds:', so timeout_seconds=0 never raised. This changes the resolution to test the NotGiven sentinel via is_given() and to compare timeouts against None, so an explicit 0 means no delay / immediate timeout while an omitted option keeps the previous default. Verified with mock-based repro (interval 0 now sleeps 0.0, timeout 0 now raises TimeoutError) plus 4 new tests in tests/test_store_helpers.py. Docker (python:3.12-bookworm): pytest 258 passed across test_store_helpers, test_utils, test_qs, test_transform, test_models; ruff check and ruff format --check clean.