Skip to content

Treat an early transport timeout at the review deadline as TIMED_OUT (fixes #89) - #173

Open
rushmithanadipally wants to merge 1 commit into
prooflinedev:mainfrom
rushmithanadipally:fix/wait-for-review-timeout
Open

rushmithanadipally wants to merge 1 commit into
prooflinedev:mainfrom
rushmithanadipally:fix/wait-for-review-timeout

Conversation

@rushmithanadipally

Copy link
Copy Markdown

Problem
wait_for_review(timeout=T) promises TIMED_OUT when time runs out. Each read is limited to the time left. If the server is silent, the read ends with the SDK timeout error. wait_for_review only turned that into TIMED_OUT when remaining() was <= 0. On Windows a socket wait can end a fraction of a millisecond early, so remaining() is still a tiny positive number and the timeout is raised as ProoflineError(0, "urn:proofline:sdk:timeout") instead (issue #89, reproduced there with 0.05 to 0.6 ms left).

Approach
Add _transport.deadline_reached(), which treats the budget as spent when 5 ms or less is left (DEADLINE_SLACK). Use it in the status-0 check in both ProoflineClient.wait_for_review and AsyncProoflineClient.wait_for_review. A timeout with real budget left still raises.

Verification

  • New tests (sync and async): a timeout reported with 0.2 ms left returns TIMED_OUT; a timeout with 30 s left still raises. The first test fails on main and passes with the change.
  • Full suite: 250 passed. python scripts/check.py passes (mypy clean, contracts, wheel and source install smoke).
  • Not run on Windows. The new test simulates the early timeout with the existing fake clock.

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