fix: remove per-step pump subscribe/unsubscribe to prevent retained m…#915
Open
fix: remove per-step pump subscribe/unsubscribe to prevent retained m…#915
Conversation
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.
Body:
Summary
The _PumpClient subscribed to status/pump before each pump step and unsubscribed after receiving "Done". Because the pump controller publishes with the MQTT retain flag, each new subscription immediately received the retained "Done" from the previous step — before the current step had started. This caused duplicate pump move commands, the pump spinning without image capture, and acquisitions hanging.
Fix
Removed three lines that performed per-step subscribe/unsubscribe:
_receive_messages(): removedunsubscribe("status/pump")after processing "Done"run_discrete(): removedsubscribe("status/pump")before publishing move commandstop(): removedsubscribe("status/pump")before publishing stop commandThe client already subscribes once in
open()and stays subscribed throughclose(). The per-step cycle was unnecessary and created the retained message vulnerability.Companion PR
This fix works together with a dashboard-side race condition fix in fairscope/dashboard
https://github.com/fairscope/dashboard/pull/new/fix/beta-feedback-batch2
which ensures the "start acquisition"function node reads acq_nb_frame from the message payload rather than relying on Node-RED globals subject to a write-ordering race.