Open freelancer1845 opened 4 years ago
The role of the scheduler parameter is different depending on where it is provided.
First, the scheduler parameter of subscribe is used to propagate a default scheduler that operators can use to emit events. This value is propagated up to the scheduler parameter of the subscription functions. Before rxpy v3, all operators that required a scheduler had a scheduler parameter. This was not convenient because you had to provide the same scheduler in many locations.
The subscribe_on operator is used to execute the subscription and disposal of an observable from another scheduler than the default one. As a consequence, operators that are before the subscribe_on operator in a pipe have their subscribe function executed from this scheduler. This is what you see in 1 and 3. Otherwise subscription and disposal is done from the context of the call to subscribe (the main thread in your examples). This is what you see in 2.
currently, the subscribe_on scheduler does not forward the default scheduler upstream. I will check but this is probably a bug. This explains why on 1 and 3 producer receives None as a scheduler. It should - TBC - be the scheduler provided in subscribe.
I'm a little confused about subscribe_on and the 'scheduler' parameter of Observable.create:
Example
Options from example
I would expect...
I guess it all resolves around understanding what the scheduler parameter that the subscriber of Observable.create gets really represents.
I hope you can understand my problem
rx==3.1.1 python=3.8.3-64bit Windows
Cheers Jascha