{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2935","repository_url":"https://api.github.com/repos/ReactiveX/rxjs","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2935/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2935/comments","events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2935/events","html_url":"https://github.com/ReactiveX/rxjs/issues/2935","id":264667876,"number":2935,"title":"Discussing the future of schedulers","user":{"login":"benlesh","id":1540597,"avatar_url":"https://avatars0.githubusercontent.com/u/1540597?v=4","gravatar_id":"","url":"https://api.github.com/users/benlesh","html_url":"https://github.com/benlesh","followers_url":"https://api.github.com/users/benlesh/followers","following_url":"https://api.github.com/users/benlesh/following{/other_user}","gists_url":"https://api.github.com/users/benlesh/gists{/gist_id}","starred_url":"https://api.github.com/users/benlesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlesh/subscriptions","organizations_url":"https://api.github.com/users/benlesh/orgs","repos_url":"https://api.github.com/users/benlesh/repos","events_url":"https://api.github.com/users/benlesh/events{/privacy}","received_events_url":"https://api.github.com/users/benlesh/received_events","type":"User","site_admin":false},"labels":[{"id":492785380,"url":"https://api.github.com/repos/ReactiveX/rxjs/labels/Next%20Major%20Version","name":"Next Major Version","color":"0e8a16","default":false},{"id":241635410,"url":"https://api.github.com/repos/ReactiveX/rxjs/labels/type:%20discussion","name":"type: discussion","color":"207de5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2017-10-11T17:17:09Z","updated_at":"2017-10-16T00:49:49Z","closed_at":null,"author_association":"OWNER","body":"Schedulers exist so we can exercise more control over when subscription occurs and when values are observed. They also provide a mechanism we can hook to get more deterministic tests that run very fast.\r\n\r\n## A few issues with the current Scheduler set up\r\n\r\n1. It's hard to build a test suite for people. \r\n  - do we need a global default scheduler? Should we just pass one around?\r\n  - if an operator defaults to a particular scheduler, do we patch it to make it use a test scheduler during test scenarios?\r\n2. It's a large and complicated part of the library\r\n3. It's a little-understood part of the library\r\n4. Scheduler arguments aren't symmetric with proposed Observable APIs, like `Observable.of`\r\n5. Still doesn't make it much easier to test things like `animationFrame` or the like.\r\n6. When a scheduler *is* needed, it must be passed around and provided to every Observable creation call and time-related operator.\r\n\r\n## Questions\r\n\r\n- In practice, is it better to have an `Observable.of(1, 2, 3, async)` or `Observable.asyncOf(1, 2, 3)`? `Observable.of(1, 2, 3, asap)` or `Observable.microtaskOf(1, 2, 3)` (name totally bike-sheddable)\r\n- Could we potentially just use `setTimeout` or `Promise` `then`, and patch them temporarily at test time? It seems like that might make it easier to build test suites. It might also reduce the size of the library.\r\n- How much do people really find the need to use Schedulers? How valuable are they if we found another way to deterministically test Observables?\r\n- Would scaling them back a great deal reduce the size of the library significantly?\r\n\r\n## Other things\r\n\r\nHaving schedulers might enable us to centralize error handling in the next version, which could help performance and reduce library size. This was one of the central changes in \"T-Rex\".\r\n\r\n**NOTE: This is just a discussion to get us to question what we've been doing with schedulers, not a change suggestion per say**\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments/336754760","html_url":"https://github.com/ReactiveX/rxjs/issues/2935#issuecomment-336754760","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/2935","id":336754760,"user":{"login":"davidwdan","id":4969183,"avatar_url":"https://avatars3.githubusercontent.com/u/4969183?v=4","gravatar_id":"","url":"https://api.github.com/users/davidwdan","html_url":"https://github.com/davidwdan","followers_url":"https://api.github.com/users/davidwdan/followers","following_url":"https://api.github.com/users/davidwdan/following{/other_user}","gists_url":"https://api.github.com/users/davidwdan/gists{/gist_id}","starred_url":"https://api.github.com/users/davidwdan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidwdan/subscriptions","organizations_url":"https://api.github.com/users/davidwdan/orgs","repos_url":"https://api.github.com/users/davidwdan/repos","events_url":"https://api.github.com/users/davidwdan/events{/privacy}","received_events_url":"https://api.github.com/users/davidwdan/received_events","type":"User","site_admin":false},"created_at":"2017-10-16T00:49:49Z","updated_at":"2017-10-16T00:49:49Z","author_association":"MEMBER","body":"With earlier versions of RxPHP we specified the scheduler at subscription time.  The main problem we ran into was when you implemented a new operator, you had to remember to pass the scheduler through to the inner subscription.  If you didn't, the scheduler would stop propagating upstream, which led to bugs that were very difficult to debug."}}
{"actor":{"display_login":"davidwdan"}}