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.485% (+0.004%) from 93.481%
when pulling 9200b06 on jcafhe:fix-subscribeon
into 7747af3 on ReactiveX:master.

@jcafhe jcafhe force-pushed the fix-subscribeon branch from 3d03194 to 0b87055 Compare July 17, 2025 20:11
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
2 participants