Repository navigation
Honor the polling interval while a live command's result file is absent - #781
Conversation
… missing read_from_file only slept in its exception handlers, but a missing result file makes cat exit nonzero with empty stdout without raising, so the loop re-ran docker exec back to back until the timeout. Sleep for the interval after an empty read.
There was a problem hiding this comment.
Approved, risk:low: the change adds one line, is easy to revert, and the new test fails on master and passes with the fix. CI is green.
A missing result file now waits interval between docker exec attempts. A result that is already there still returns on the first read. The only cost is that the last empty read can run past timeout by up to one interval. That is 1s against the 30s timeout lean live commands use, which is fine.
There was a problem hiding this comment.
Approved. No blocking regression found.
Independent verification:
- Full local suite: 2,913 passed, 81 skipped. The new missing-file regression test fails against master; the ready-result test passes on both.
- Tested end to end: a missing file produced 4 Docker reads in 4.68s, versus 23 in 4.12s on master, with at least one second between retries. A ready result returned after one read in 0.17s on both. The live-command result caller also successfully picked up a result created after polling started.
The final sleep can extend the wait by one interval, consistent with the existing retry paths; callers use a one-second interval and a 30-second timeout. Separate baseline defects reproduced on both versions are tracked in #783–#786 and do not block this fix.
Closes #748
DockerManager.read_from_fileslept only in its exception handlers. A result file that doesn't exist yet makescatexit nonzero with empty output, which doesn't raise, so the loop launcheddocker execagain right away until the timeout. It now sleeps forintervalafter an empty read. A result that is already there still returns at once, with no sleep.The commit is cherry-picked from #768 by @pcbeingused333, with authorship kept.
Testing
tests/components/docker/test_docker_manager.py: an empty read sleeps for the interval (fails on master), and a ready result returns without sleeping.python -m pytest -q -rs: 2913 passed, 81 skipped.read_from_file(..., interval=1, timeout=4):docker execcalls over 4.8s (master: 24 calls over 4.2s){"Success": true}: success after 1 call in 0.19s (same as master)