-
Notifications
You must be signed in to change notification settings - Fork 341
Open
Labels
bug reportReported bug.Reported bug.
Description
FlatMap not run parallelly WithPool or WithCPUPool
See:
package main
import (
"fmt"
"time"
"github.com/reactivex/rxgo/v2"
)
func main() {
obs := rxgo.Just(1, 2, 3)().FlatMap(
func(i rxgo.Item) rxgo.Observable {
time.Sleep(time.Second)
return rxgo.Just(i.V.(int)*10, i.V.(int)*100)()
},
rxgo.WithCPUPool(),
)
start := time.Now().Unix()
for item := range obs.Observe() {
fmt.Printf("item: %+v\n", item)
}
end := time.Now().Unix()
fmt.Printf("cost: %d seconds\n", end-start)
}
Expect:
cost 1 seconds
Actual:
cost 3 seconds
nitedani
Metadata
Metadata
Assignees
Labels
bug reportReported bug.Reported bug.