FindFirstAndFlush flushes source concurrently

This commit is contained in:
milarin 2022-12-19 18:03:43 +01:00
parent a85ba0011d
commit 79805d1fdc

View File

@ -9,7 +9,7 @@ func FindFirst[T any](source <-chan T) *T {
func FindFirstAndFlush[T any](source <-chan T) *T { func FindFirstAndFlush[T any](source <-chan T) *T {
for v := range source { for v := range source {
Flush(source) go Flush(source)
return &v return &v
} }
return nil return nil