Skip to content

Commit d04fb0b

Browse files
committed
1.x: combineLatest can now combine arbitrary number of sources
This PR is a backport of the 2.x `combineLatest` with `null` support and let's the programmer combine more than 128 sources at once. The original had this 128 limit due to using a single and non-parametric RxRingBuffer to store values from sources. In addition, the original algorithm divided downstream requests among the sources with some strange logic in order to keep them running and not overflow the buffer. This PR uses an unbounded SPSC queue which can now hold as many elements as there are sources times the default ring buffer size (this is not preallocated and grows/shrinks as necessary). The algorithm stores the current latest array and the source subscriber in the queue in pairs so when that particular row is emitted to downstream, that source subscriber gets the request() replenishment call that generated the row.
1 parent 3e2b3b1 commit d04fb0b

File tree

2 files changed

+422
-287
lines changed

2 files changed

+422
-287
lines changed

0 commit comments

Comments
 (0)