fix(publishers): fix BufferedPublisher retains its buffer after close - #345
Conversation
|
@claude review |
|
Claude finished @LizzyC-115's task in 2m 48s —— View job Review: fix(publishers) double-close on BufferedPublisher
Overview: The fix is correctly targeted — Left 3 inline comments (all minor, non-blocking):
No driver-convention, docs-sync, or breaking-change concerns — this is an internal bugfix to existing lib code, not a public API change. |
|
PR author is not in the allowed authors list. |
|
Claude finished @LizzyC-115's task in 2m 59s —— View job Review: fix(publishers) double-close on BufferedPublisher
Overview: The three earlier findings from this branch's first review pass are all resolved-by-response: the hardcoded One new inline note: the test file pairs a weak ( No further action needed from me unless you want the redundant tests trimmed. |
Summary
In the original implementation, BufferedPublisher would close by calling
publish_batch()thenclose(). However,publish_batch()did not clear the buffer and whenclose()is called twice, a ValueError occurs.This PR introduces a
_closedflag in the init of the BufferedPublisher. This flag is used to check the closed state of the publisher. If we are closed, then we will avoid touching the buffer, making close() be idempotent. Additionally, we add aself.buffer.close()call to clear the buffer whenclose()is called so the buffer ends in an empty state.Type of change
fix)feat)feat!/fix!)refactor)docs)chore)Verification
Tests
Checklist
feat(driver): add support for Keysight E36300)Notes for reviewers
Adding a logger warning when attempting to call
close()orpublish()after the BufferedPublisher is closed to keep consistency with the other publishers.