package util func DrainChannelBuffer[T any](ch <-chan T) (ok bool) { for { select { case _, ok = <-ch: if !ok { return } default: return true } } }