-
-
Notifications
You must be signed in to change notification settings - Fork 244
Open
Milestone
Description
Hi there!
I need to use groupBy with concatMap to ensure sequentally groups processing.
The following code loses or duplicates items while processing:
val count = 10
val items = Vector(1, 2, 3)
Observable.repeat(items: _*)
.take(count * items.size)
.groupBy(identity)
.concatMap(_.dump("O").take(10).sum)
.sumL
.map { result =>
val expected = List(1, 2, 3).map(_ * count).sum
println(s"expected '$expected', result '$result', pass '${expected == result}'")
}
.runToFutureOutput:
0: O --> 1
1: O --> 1
2: O --> 1
3: O --> 1
4: O --> 1
5: O --> 1
6: O --> 1
7: O --> 1
8: O --> 1
9: O --> 1
11: O stopped
0: O --> 2
1: O --> 2
2: O --> 2
3: O --> 2
4: O --> 2
5: O --> 2
6: O --> 2
7: O --> 2
8: O --> 2
9: O --> 2
11: O stopped
0: O --> 3
1: O --> 3
2: O --> 3
3: O --> 3
4: O --> 3
5: O --> 3
6: O --> 3
7: O --> 3
8: O --> 3
9: O --> 3
11: O stopped
0: O --> 1
1: O completed
expected '60', result '61', pass 'false'
Why is this happening and how can I get it to work correctly?
Metadata
Metadata
Assignees
Labels
No labels