Skip to content

fix: remove per-step pump subscribe/unsubscribe to prevent retained m…#915

Open
babo989 wants to merge 1 commit intomainfrom
fix/pump-retained-message-race
Open

fix: remove per-step pump subscribe/unsubscribe to prevent retained m…#915
babo989 wants to merge 1 commit intomainfrom
fix/pump-retained-message-race

Conversation

@babo989
Copy link
Collaborator

@babo989 babo989 commented Mar 18, 2026

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(): removed unsubscribe("status/pump") after processing "Done"
  • run_discrete(): removed subscribe("status/pump") before publishing move command
  • stop(): removed subscribe("status/pump") before publishing stop command

The client already subscribes once in open() and stays subscribed through close(). 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.

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