Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix subscribe_on not forwarding scheduler to the source #726

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

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
1 participant