feat(events): add Close() method to ChannelEmitter

Allows consumers to signal the drain goroutine to stop by closing
the underlying channel. Used by CLI dispatch watch cleanup.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-02-20 12:46:48 +00:00
parent a29ded5159
commit 4628b2b094
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -78,6 +78,11 @@ func (e *ChannelEmitter) Events() <-chan Event {
return e.ch
}
// Close closes the underlying channel, signalling consumers to stop reading.
func (e *ChannelEmitter) Close() {
close(e.ch)
}
// MultiEmitter fans out events to multiple emitters. Emission continues even
// if one emitter fails — errors are collected but not returned.
type MultiEmitter struct {