We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf1a4f3 commit d217209Copy full SHA for d217209
src/main/java/rx/internal/operators/OperatorTake.java
@@ -61,12 +61,16 @@ public void onError(Throwable e) {
61
@Override
62
public void onNext(T i) {
63
if (!isUnsubscribed()) {
64
- child.onNext(i);
65
if (++count >= limit) {
66
completed = true;
67
- child.onCompleted();
+ // unsubscribe before emitting onNext so shutdown happens before possible effects
+ // of onNext such as product.request(n) calls be sent upstream.
68
unsubscribe();
69
}
70
+ child.onNext(i);
71
+ if (completed) {
72
+ child.onCompleted();
73
+ }
74
75
76
0 commit comments