{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/2587","labels_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/2587/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/2587/comments","events_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/2587/events","html_url":"https://github.com/ReactiveX/RxJava/issues/2587","id":56400093,"number":2587,"title":"take + repeat + distinct not completing","user":{"login":"hamen","id":19003,"avatar_url":"https://avatars.githubusercontent.com/u/19003?v=3","gravatar_id":"","url":"https://api.github.com/users/hamen","html_url":"https://github.com/hamen","followers_url":"https://api.github.com/users/hamen/followers","following_url":"https://api.github.com/users/hamen/following{/other_user}","gists_url":"https://api.github.com/users/hamen/gists{/gist_id}","starred_url":"https://api.github.com/users/hamen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamen/subscriptions","organizations_url":"https://api.github.com/users/hamen/orgs","repos_url":"https://api.github.com/users/hamen/repos","events_url":"https://api.github.com/users/hamen/events{/privacy}","received_events_url":"https://api.github.com/users/hamen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-03T16:22:46Z","updated_at":"2015-02-03T19:33:23Z","closed_at":null,"body":"Hi all\r\nI'm having a hard time trying to figure this out:\r\n\r\n```java\r\nObservable<AppInfo> sequence = Observable.from(apps)\r\n                .take(3)\r\n                .repeat(3);\r\n\r\n        sequence.subscribe(new Observer<AppInfo>() {\r\n            @Override\r\n            public void onCompleted() {\r\n                Log.d(\"RXJAVA1\", \"Completed\");\r\n            }\r\n\r\n            @Override\r\n            public void onError(Throwable e) {\r\n                Log.e(\"RXJAVA1\", \"Error\");\r\n            }\r\n\r\n            @Override\r\n            public void onNext(AppInfo appInfo) {\r\n                Log.d(\"RXJAVA1\", appInfo.getName());\r\n            }\r\n        });\r\n\r\n        sequence.distinct()\r\n                .subscribe(new Observer<AppInfo>() {\r\n                    @Override\r\n                    public void onCompleted() {\r\n                        Log.d(\"RXJAVA2\", \"Completed\");\r\n                    }\r\n\r\n                    @Override\r\n                    public void onError(Throwable e) {\r\n                        Log.e(\"RXJAVA2\", \"Error\");\r\n                    }\r\n\r\n                    @Override\r\n                    public void onNext(AppInfo appInfo) {\r\n                        Log.d(\"RXJAVA2\", appInfo.getName());\r\n                    }\r\n                });\r\n```\r\ngives me\r\n```\r\nD/RXJAVA1﹕ 9GAG\r\nD/RXJAVA1﹕ AdSense\r\nD/RXJAVA1﹕ AirDroid\r\nD/RXJAVA1﹕ 9GAG\r\nD/RXJAVA1﹕ AdSense\r\nD/RXJAVA1﹕ AirDroid\r\nD/RXJAVA1﹕ 9GAG\r\nD/RXJAVA1﹕ AdSense\r\nD/RXJAVA1﹕ AirDroid\r\nD/RXJAVA1﹕ Completed\r\nD/RXJAVA2﹕ 9GAG\r\nD/RXJAVA2﹕ AdSense\r\nD/RXJAVA2﹕ AirDroid\r\n```\r\nand the sequence never completes. If I only repeat it twice:\r\n\r\n```java\r\nObservable<AppInfo> sequence = Observable.from(apps)\r\n                .take(3)\r\n                .repeat(2);\r\n\r\n        sequence.subscribe(new Observer<AppInfo>() {\r\n            @Override\r\n            public void onCompleted() {\r\n                Log.d(\"RXJAVA1\", \"Completed\");\r\n            }\r\n\r\n            @Override\r\n            public void onError(Throwable e) {\r\n                Log.e(\"RXJAVA1\", \"Error\");\r\n            }\r\n\r\n            @Override\r\n            public void onNext(AppInfo appInfo) {\r\n                Log.d(\"RXJAVA1\", appInfo.getName());\r\n            }\r\n        });\r\n\r\n        sequence.distinct()\r\n                .subscribe(new Observer<AppInfo>() {\r\n                    @Override\r\n                    public void onCompleted() {\r\n                        Log.d(\"RXJAVA2\", \"Completed\");\r\n                    }\r\n\r\n                    @Override\r\n                    public void onError(Throwable e) {\r\n                        Log.e(\"RXJAVA2\", \"Error\");\r\n                    }\r\n\r\n                    @Override\r\n                    public void onNext(AppInfo appInfo) {\r\n                        Log.d(\"RXJAVA2\", appInfo.getName());\r\n                    }\r\n                });\r\n```\r\nI get\r\n```\r\nD/RXJAVA1﹕ 9GAG\r\nD/RXJAVA1﹕ AdSense\r\nD/RXJAVA1﹕ AirDroid\r\nD/RXJAVA1﹕ 9GAG\r\nD/RXJAVA1﹕ AdSense\r\nD/RXJAVA1﹕ AirDroid\r\nD/RXJAVA1﹕ Completed\r\nD/RXJAVA2﹕ 9GAG\r\nD/RXJAVA2﹕ AdSense\r\nD/RXJAVA2﹕ AirDroid\r\nD/RXJAVA2﹕ Completed\r\n```\r\nand everything is fine.\r\nI'm working on some examples and I spotted this weird scenario and it's driving me crazy. Am I missing something or there is actually something wrong with this?\r\nThanks"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/comments/72718077","html_url":"https://github.com/ReactiveX/RxJava/issues/2587#issuecomment-72718077","issue_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/2587","id":72718077,"user":{"login":"akarnokd","id":1269832,"avatar_url":"https://avatars.githubusercontent.com/u/1269832?v=3","gravatar_id":"","url":"https://api.github.com/users/akarnokd","html_url":"https://github.com/akarnokd","followers_url":"https://api.github.com/users/akarnokd/followers","following_url":"https://api.github.com/users/akarnokd/following{/other_user}","gists_url":"https://api.github.com/users/akarnokd/gists{/gist_id}","starred_url":"https://api.github.com/users/akarnokd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akarnokd/subscriptions","organizations_url":"https://api.github.com/users/akarnokd/orgs","repos_url":"https://api.github.com/users/akarnokd/repos","events_url":"https://api.github.com/users/akarnokd/events{/privacy}","received_events_url":"https://api.github.com/users/akarnokd/received_events","type":"User","site_admin":false},"created_at":"2015-02-03T19:33:23Z","updated_at":"2015-02-03T19:33:23Z","body":"Hmm. If I apply distinct(), I don't get the Completed message either. I'm going to investigate this."}}