snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s
Some checks failed
master / ci (push) Failing after 0s
This commit is contained in:
15
internal/channel.go
Normal file
15
internal/channel.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package internal
|
||||
|
||||
// IsChannelClosed returns true if provided `chan struct{}` is closed.
|
||||
// IsChannelClosed panics if message is sent to this channel.
|
||||
func IsChannelClosed(channel chan struct{}) bool {
|
||||
select {
|
||||
case _, ok := <-channel:
|
||||
if ok {
|
||||
panic("received unexpected message")
|
||||
}
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user