Skip to content

imager: remove per-step pump subscribe/unsubscribe #915

Merged
sonnyp merged 2 commits intomainfrom
fix/pump-retained-message-race
Mar 23, 2026
Merged

imager: remove per-step pump subscribe/unsubscribe #915
sonnyp merged 2 commits 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.

@sonnyp sonnyp changed the title fix: remove per-step pump subscribe/unsubscribe to prevent retained m… imager: remove per-step pump subscribe/unsubscribe Mar 23, 2026
@sonnyp sonnyp merged commit d1cbb88 into main Mar 23, 2026
1 check passed
@sonnyp sonnyp deleted the fix/pump-retained-message-race branch March 23, 2026 15:14
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.

2 participants