{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4362","repository_url":"https://api.github.com/repos/ReactiveX/RxJava","labels_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4362/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4362/comments","events_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4362/events","html_url":"https://github.com/ReactiveX/RxJava/issues/4362","id":171722628,"number":4362,"title":"ReplaySubject and Filter, bug or feature?","user":{"login":"Cher80","id":1109620,"avatar_url":"https://avatars.githubusercontent.com/u/1109620?v=3","gravatar_id":"","url":"https://api.github.com/users/Cher80","html_url":"https://github.com/Cher80","followers_url":"https://api.github.com/users/Cher80/followers","following_url":"https://api.github.com/users/Cher80/following{/other_user}","gists_url":"https://api.github.com/users/Cher80/gists{/gist_id}","starred_url":"https://api.github.com/users/Cher80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cher80/subscriptions","organizations_url":"https://api.github.com/users/Cher80/orgs","repos_url":"https://api.github.com/users/Cher80/repos","events_url":"https://api.github.com/users/Cher80/events{/privacy}","received_events_url":"https://api.github.com/users/Cher80/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ReactiveX/RxJava/labels/Question","name":"Question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-17T18:04:59Z","updated_at":"2016-08-25T23:39:05Z","closed_at":null,"body":"Hi, \r\nI have two subsribers for one ReplaySubject. \r\nSubscriber1 filters emited objects for type 1   -- replaySubject.filter(1).subscribe()\r\nSubscriber2 filters emited objects for type 2  -- replaySubject.filter(2).subscribe()\r\n\r\nI emit from my ReplaySubject objects of types 1,1,1,1,2 (one on click)\r\nSubscriber1 gets 1,1,1,1\r\nthen on the next click\r\nSubscriber2 gets 2 and (!INTERSTING!) Subscriber1 gets 1,1,1,1 again.\r\n\r\nLooks like there are some logic of ReplaySubject based on if onNext was called (on not called in case of filtering) and force ReplaySubject to reemit the objects \r\nI can provide simplified code if needed\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/comments/242579873","html_url":"https://github.com/ReactiveX/RxJava/issues/4362#issuecomment-242579873","issue_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/4362","id":242579873,"user":{"login":"ncanibano","id":6556066,"avatar_url":"https://avatars.githubusercontent.com/u/6556066?v=3","gravatar_id":"","url":"https://api.github.com/users/ncanibano","html_url":"https://github.com/ncanibano","followers_url":"https://api.github.com/users/ncanibano/followers","following_url":"https://api.github.com/users/ncanibano/following{/other_user}","gists_url":"https://api.github.com/users/ncanibano/gists{/gist_id}","starred_url":"https://api.github.com/users/ncanibano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncanibano/subscriptions","organizations_url":"https://api.github.com/users/ncanibano/orgs","repos_url":"https://api.github.com/users/ncanibano/repos","events_url":"https://api.github.com/users/ncanibano/events{/privacy}","received_events_url":"https://api.github.com/users/ncanibano/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T23:39:05Z","updated_at":"2016-08-25T23:39:05Z","body":"We found out a similar strange behavior in our app with ReplaySubject and filter duplicating items.\r\nYou can reproduce it with this code snippet:\r\n```\r\nobject RxTest {\r\n\r\n  def main(args: Array[String]): Unit = {\r\n    val subject = ReplaySubject[Int]()\r\n\r\n    val result = subject\r\n      .filter(_ > 0)\r\n\r\n    result.subscribe(chunk ⇒ println(chunk))\r\n\r\n    subject.onNext(1)\r\n    subject.onNext(2)\r\n    subject.onNext(0)\r\n    subject.onNext(3)\r\n    subject.onNext(0)\r\n    subject.onNext(6)\r\n  }\r\n\r\n}\r\n```\r\nWe are using RxJava v1.1.6 and RxScala v0.26.2.\r\nThis is the expected behavior or do you think is there an issue here?"}}
{"actor":{"display_login":"ncanibano"}}