{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/393","labels_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/393/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/393/comments","events_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/393/events","html_url":"https://github.com/ReactiveX/RxSwift/issues/393","id":125251901,"number":393,"title":"`.observeOn(MainScheduler.sharedInstance)` events delivered out of order","user":{"login":"dpassage","id":277491,"avatar_url":"https://avatars.githubusercontent.com/u/277491?v=3","gravatar_id":"","url":"https://api.github.com/users/dpassage","html_url":"https://github.com/dpassage","followers_url":"https://api.github.com/users/dpassage/followers","following_url":"https://api.github.com/users/dpassage/following{/other_user}","gists_url":"https://api.github.com/users/dpassage/gists{/gist_id}","starred_url":"https://api.github.com/users/dpassage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpassage/subscriptions","organizations_url":"https://api.github.com/users/dpassage/orgs","repos_url":"https://api.github.com/users/dpassage/repos","events_url":"https://api.github.com/users/dpassage/events{/privacy}","received_events_url":"https://api.github.com/users/dpassage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-06T20:06:53Z","updated_at":"2016-01-07T00:05:59Z","closed_at":null,"body":"This may not be a bug, but I'd welcome suggestions on how to deal with it. (I'm still on 2.0.0 beta 3; working on updating to the release version in parallel.)\r\n\r\nI have a Variable in class A. There's a method in class B which observes it on the main thread:\r\n\r\n```\r\n        updateService.currentVersion\r\n            .observeOn(MainScheduler.sharedInstance)\r\n            .subscribe { event in\r\n...\r\n```\r\n\r\nIn the other object, I first set the value to `1` on the background thread, and then to `2` on the main thread.\r\n\r\nAt the subscriber, however, I'm seeing them out of order: first `2` and then `1`.\r\n\r\nI'm guessing that's because `observeOn` turns into a no-op if the current thread is the same as the scheduler's thread, and thus the `2` is delivered immediately while the `1` goes to GCD jail for a beat.\r\n\r\nCan anyone recommend a good way to deal with this? Should I do all updates to the `Variable` on the main thread?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/comments/169504422","html_url":"https://github.com/ReactiveX/RxSwift/issues/393#issuecomment-169504422","issue_url":"https://api.github.com/repos/ReactiveX/RxSwift/issues/393","id":169504422,"user":{"login":"dpassage","id":277491,"avatar_url":"https://avatars.githubusercontent.com/u/277491?v=3","gravatar_id":"","url":"https://api.github.com/users/dpassage","html_url":"https://github.com/dpassage","followers_url":"https://api.github.com/users/dpassage/followers","following_url":"https://api.github.com/users/dpassage/following{/other_user}","gists_url":"https://api.github.com/users/dpassage/gists{/gist_id}","starred_url":"https://api.github.com/users/dpassage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpassage/subscriptions","organizations_url":"https://api.github.com/users/dpassage/orgs","repos_url":"https://api.github.com/users/dpassage/repos","events_url":"https://api.github.com/users/dpassage/events{/privacy}","received_events_url":"https://api.github.com/users/dpassage/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T00:05:59Z","updated_at":"2016-01-07T00:05:59Z","body":"Just upgraded to 2.0.0, exact same issue."}}