Always queue image delivery services#63
Open
LordMike wants to merge 3 commits into
Open
Conversation
Member
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.
Why
I tested the clean-port branch on a Home Assistant instance using bleproxy to reach a display over a weak, long-range BLE connection. The display does eventually receive images, but a tiny
drawcustom"Hello World" payload took 25 seconds before the service call returned; another run took 36 seconds.That delay comes from the current opportunistic behavior: if the device was seen recently, the service tries live delivery first and only queues if that path does not complete. The problem is that the service call is now indeterministic and cannot be relied on. As a script or automation author, I cannot assume that the service will complete quickly or slowly, and I cannot assume that the image has rendered or not. I must instead inspect the response to see whether it was queued.
This PR makes image services use one deterministic contract: render/prepare the image, submit it to delivery, and return once the queue accepts it. The delivery queue can still immediately try to drain in the background when the device appears reachable, but physical delivery is represented by queue state/events rather than inferred from service-call duration.
That avoids a misleading automation contract. A user should not see one
drawcustomcall block until the panel updates and then reasonably assume "when this service returns, the image has rendered", only for a later call to return after queueing because the BLE timing was different.What Changed
DeliveryManager.Validation
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=/mnt/n/Personal/opendisplay-work/Home_Assistant_Integration /home/mike/.venvs/hass-dev/bin/python -m pytest -q tests -p no:cacheprovider44 passedThis PR was sparked by my comment here: #31 (comment), and developed by codex and tested against a reTerminal E1002.