fix(mcs_card): handle excess data points and improve MCA callback suppression #308
Merged
menzel
merged 1 commits from 2026-09-08 13:32:36 +02:00
fix/mcs_card_suppression into main
Labels
Clear labels
issue::not confirmed
issue::not reproducible
issue::reproducible
priority::critical
priority::needed
priority::nice to have
scope::backend
scope::frontend
stage::in development
stage::on hold
stage::pre_release
stage::ready for review
stage::selected for development
stage::weekly backlog
type::bug
type::discussion
type::doc
type::feature
type::improvement
type::test
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
Used if an issue has not yet been confirmed by a developer
Used if an issue is not reproducible
Used if a developer was able to reproduce the issue
Should be done as soon as possible
An important update to the code base
Not really needed but a good improvement
An issue regarding the backend services
An issue regarding the user-facing services
This issue is currently being worked on
Something is blocking the development
For issues that have been merged into a pre-release branch and are waiting for their release.
For issues that have been resolved and are ready for review
This issue has been selected for development but has not been scheduled yet
This issue has been selected for development for the next development cycle
It's a bug!
A discussion is wanted/needed
Improvements to the documentation
A new feature
Neither a feature nor a bug but an improvement to the code base
Missing tests or improvements to the test suite
Something is not working
This issue or pull request already exists
New feature
Need some help
Something is wrong
More information is needed
This won't be fixed
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
acerbo_a (acerbo_a)
bec-gitea
chen_h2 (chen_h2)
debenjak_l (debenjak_l)
diaz (diaz)
divall_e (divall_e)
guizar_m (guizar_m)
haghta_s (haghta_s)
holler (holler)
lombosi_c (lombosi_c)
malu_s (malu_s)
menzel (menzel)
perl_d (perl_d)
usov_i (usov_i)
wakonig_k (wakonig_k)
wang_x1 (wang_x1)
wyzula_j (wyzula_j)
zamofing_t (zamofing_t)
zhang_y7 (zhang_y7)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: bec/csaxs_bec#308
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The MCS card emits MCA updates while erasing. A suppression mechanism prevents these updates from leaking into scan data, but its locking logic contained a bug.
Previously, the suppression mechanism held the data lock, preventing pending callbacks from running and being discarded. Once suppression ended, those callbacks could be processed as scan data. This change releases the lock during suppression, allowing callbacks to run, detect suppression, and discard their data.
Additionally, completion now fails immediately with a clear error if more points are received than expected.
The docstring NOTE (lines 60–63) says _omit_mca_callbacks "will remain set after exiting the context" — only true for restore_after_timeout=None. Since the whole change is about subtle locking, it would be worth stating there, not just in the inline comment, that the lock is deliberately not held across the body.
2. suppress_mca_callbacks doesn't clear _current_data, so a suppression starting mid-batch leaves a partial dict that merges with the next batch. Every current call site happens to be covered by its caller, so it isn't live — but clearing it under the lock alongside setting the flag would make the context manager self-sufficient.