fix: fx/fn.Head func will forever block when n is less than 1 (#128)

* fix fx/Stream Head func will forever block when n is less than 1

* update test case

* update test case
This commit is contained in:
codingfanlt
2020-10-15 14:10:37 +08:00
committed by GitHub
parent c824e9e118
commit 901fadb5d3
2 changed files with 11 additions and 0 deletions

View File

@@ -159,6 +159,9 @@ func (p Stream) Group(fn KeyFunc) Stream {
}
func (p Stream) Head(n int64) Stream {
if n < 1 {
panic("n must be greater than 0")
}
source := make(chan interface{})
go func() {