Skip to content

Conversation

@jcafhe
Copy link
Collaborator

@jcafhe jcafhe commented Feb 20, 2025

This PR fixes the subscribe_on operator that actually doesn't forward the scheduler to the source.

This is noticeable when one wants to implement an obsersvable by using a subscribe function:

my_scheduler = EventLoopScheduler()

def source():
    def subscribe(observer, _scheduler):
        # here, _scheduler is None instead of my_scheduler
        ...
    return rx.create(subscribe)

source().pipe(
    ops.subscribe_on(my_scheduler)
).run()

I believe this is not aligned with the documentation which states the following:

wrap the source sequence in order to run its subscription and unsubscription logic on the specified scheduler

I think it should fix #541 as well.

@coveralls
Copy link

coveralls commented Mar 28, 2025

Coverage Status

coverage: 93.462% (+0.004%) from 93.458%
when pulling c75da01 on jcafhe:fix-subscribeon
into c748e58 on ReactiveX:master.

@jcafhe jcafhe force-pushed the fix-subscribeon branch from 3d03194 to 0b87055 Compare July 17, 2025 20:11
@dbrattli dbrattli merged commit 788a6f9 into ReactiveX:master Nov 8, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"subscribe_on" and Observable.create "scheduler" parameter inconsistent

3 participants