File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
main/java/rx/internal/operators
test/java/rx/internal/operators Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -501,7 +501,7 @@ void manageRequests() {
501
501
InnerProducer <T >[] a = producers .get ();
502
502
503
503
long ri = maxChildRequested ;
504
- long maxTotalRequests = 0 ;
504
+ long maxTotalRequests = ri ;
505
505
506
506
for (InnerProducer <T > rp : a ) {
507
507
maxTotalRequests = Math .max (maxTotalRequests , rp .totalRequested .get ());
Original file line number Diff line number Diff line change @@ -1120,4 +1120,29 @@ public void onNext(Integer t) {
1120
1120
ts .assertNotCompleted ();
1121
1121
ts .assertError (TestException .class );
1122
1122
}
1123
+
1124
+ @ Test
1125
+ public void unboundedLeavesEarly () {
1126
+ PublishSubject <Integer > source = PublishSubject .create ();
1127
+
1128
+ final List <Long > requests = new ArrayList <Long >();
1129
+
1130
+ Observable <Integer > out = source
1131
+ .doOnRequest (new Action1 <Long >() {
1132
+ @ Override
1133
+ public void call (Long t ) {
1134
+ requests .add (t );
1135
+ }
1136
+ }).replay ().autoConnect ();
1137
+
1138
+ TestSubscriber <Integer > ts1 = TestSubscriber .create (5 );
1139
+ TestSubscriber <Integer > ts2 = TestSubscriber .create (10 );
1140
+
1141
+ out .subscribe (ts1 );
1142
+ out .subscribe (ts2 );
1143
+ ts2 .unsubscribe ();
1144
+
1145
+ Assert .assertEquals (Arrays .asList (5L , 5L ), requests );
1146
+ }
1147
+
1123
1148
}
You can’t perform that action at this time.
0 commit comments