Tags: JustinDFuller/nozzle
Tags
Fix: Make OnStateChange callbacks non-blocking (#33) * fix: make OnStateChange callbacks non-blocking The OnStateChange callback was executed synchronously while holding the mutex, which could delay the ticker and block all nozzle operations if the callback was slow. Changes: - Execute callbacks asynchronously in separate goroutines - Add context.Context parameter for cancellation support - Add Timestamp field to StateSnapshot to record when changes occur - Add panic recovery to prevent callback panics from crashing - Update all tests and examples for new callback signature - Add comprehensive tests for async behavior This is a breaking change to the callback signature but fixes the blocking issue completely. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * docs: remove breaking change notices per v0 status This is a v0 library, so breaking changes are expected. Removed explicit breaking change notices from documentation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * docs: simplify context cancellation check in examples Use ctx.Err() != nil instead of select statement for one-off context cancellation checks. This is simpler and more idiomatic. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: resolve linter errors - Use underscore for unused parameters in callbacks - Rename short variable names (mu -> mutex) - Add proper error handling for Close() calls - Remove unused Timestamp.IsZero() check 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: resolve linter errors in test files - Rename short variable 'n' to 'noz' throughout test files - Add required whitespace before defer statements per wsl linter - Fix all golangci-lint warnings 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>