Skip to content

Still one "chain" after combining operators on two or more Observable? #659

Answered by boholder
boholder asked this question in Q&A
Discussion options

You must be logged in to vote

It looks like that the answer is true, Observables at the start the the "execution tree" will follow the setting set at end:

def my_concurrency_test():
    pool_scheduler = ThreadPoolScheduler(2)

    def num_map(num: int):
        print(f'[num] {current_thread().name} : {num}')
        return num

    num = rx.range(1, 5).pipe(op.map(num_map))

    def name_map(name: str):
        print(f'[name] {current_thread().name} : {name}')
        return name

    name = rx.from_iterable(["Alpha", "Beta", "Gamma", "Delta", "Epsilon"]).pipe(op.map(name_map))

    zipped = rx.zip(num, name)
    merged = rx.merge(num, name)

    merged.pipe(op.subscribe_on(pool_scheduler)).subscribe(
        on_next=l…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by boholder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant