-
Notifications
You must be signed in to change notification settings - Fork 7.6k
concat can't display all the groupedBy observers on version 1.1.1 #3775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Strange. This code works for me on 1.1.1: public class GroupConcat {
static final class AppInfo {
String name;
LocalDate date;
@Override
public String toString() {
return name + " @ " + date;
}
}
public static void main(String[] args) {
System.setProperty("rx.ring-buffer.size", "16");
List<AppInfo> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 3; j++) {
AppInfo ai = new AppInfo();
ai.name = i + " - " + j;
ai.date = LocalDate.of(2016, 3, i + 1);
list.add(ai);
}
}
Observable<GroupedObservable<String, AppInfo>> o = Observable.from(list)
.groupBy(v -> v.date.format(DateTimeFormatter.ofPattern("MM/yyyy")));
Observable.concat(o)
.subscribe(System.out::println);
}
} |
public class Concat {
public static class Student {
public String classId;
public String name;
@Override
public String toString() {
return "Student{classId='" + classId + "', name='" + name + "'}";
}
}
public static void main(String[] args) {
ArrayList<Student> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
Student student = new Student();
student.classId = String.valueOf(i % 5);
student.name = String.valueOf(i);
list.add(student);
}
Observable<GroupedObservable<String, Student>> groupBy =
Observable.from(list)
.groupBy(new Func1<Student, String>() {
@Override
public String call(Student student) {
return student.classId;
}
});
Observable.concat(groupBy)
.subscribe(new Observer<Student>() {
@Override
public void onCompleted() {
System.out.println("Completed");
}
@Override
public void onError(Throwable e) {
System.out.println("Error");
}
@Override
public void onNext(Student student) {
System.out.println(student);
}
});
}
} in RxJava 1.1.1,console print :
in RxJava 1.1.0,console print :
1.1.1 only print first group, and not call System OS : windows 10 64-bit |
Yep, this is a bug. The groups don't complete until all groups have been emitted which doesn't happen because concat() prefetches only 2 groups of the 5. I overlooked this case and apparently the unit tests weren't checking for this. |
See the fix in #3787. |
👍 |
Closing via #3787. |
Here are the code I‘m using to test:
and the library is :
I got this result which apparently is not correct, I only got three results!:

but it should be like this as shown on the Rxjava-essential-code.

This problem never occurs on Version 1.1.0.
The text was updated successfully, but these errors were encountered: