RxGo
RxGo copied to clipboard
In GroupByDynamic example,when I set count to 100,the program will be blocked
In GroupByDynamic example,when I set count to 100,the program will be blocked,just print part of result my go version is go1.15.10 darwin/amd64,rxgo version is 2.5.0

in current example, new group observable isn't be consumed ASAP. so it block when one group observable buffer full. we should modify the example
func main() {
count := 3
observable := rxgo.Range(0, 100).GroupByDynamic(func(item rxgo.Item) string {
return strconv.Itoa(item.V.(int) % count)
})
disposeds := make([]rxgo.Disposed, 0)
for i := range observable.Observe() {
groupedObservable := i.V.(rxgo.GroupedObservable)
fmt.Printf("New observable: %s\n", groupedObservable.Key)
disposeds = append(disposeds, groupedObservable.DoOnNext(func(i interface{}) {
fmt.Printf("item: %v\n", i)
}))
}
for _, disposed := range disposeds {
<-disposed
}
}