Skip to content

fix(sdk): honor explicit zero poll_interval_ms and poll_timeout_ms - #278

Open
Tyagiquamar wants to merge 1 commit into
mixedbread-ai:mainfrom
Tyagiquamar:fix/honor-zero-poll-options
Open

Tyagiquamar wants to merge 1 commit into
mixedbread-ai:mainfrom
Tyagiquamar:fix/honor-zero-poll-options

Conversation

@Tyagiquamar

Copy link
Copy Markdown

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.

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.
@Tyagiquamar

Copy link
Copy Markdown
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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant