Skip to content
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

BufferTimeout with fair backpressure rework #3634

Open
wants to merge 12 commits into
base: 3.5.x
Choose a base branch
from
Expand Up @@ -419,38 +419,27 @@ private void drain() {
}
// make another spin if there's more work
} else {
if (completed) {
// if queue is empty, the discard is ignored
if (completed || terminated == TERMINATED_WITH_CANCEL) {
if (logger != null) {
trace(logger, "Discarding entire queue of " + queue.size());
}
Operators.onDiscardQueueWithClear(queue, currentContext(),
null);
return;
}
// TODO: potentially the below can be executed twice?
if (terminated == TERMINATED_WITH_CANCEL) {
if (logger != null) {
trace(logger, "Discarding entire queue of " + queue.size());
}
Operators.onDiscardQueueWithClear(queue, currentContext(),
null);
return;
}
while (flushABuffer()) {
// no-op
}
if (queue.isEmpty()) {
completed = true;
if (this.error != null) {
actual.onError(this.error);
}
else {
actual.onComplete();
}
Operators.onDiscardQueueWithClear(queue, currentContext(), null);
} else {
if (logger != null) {
trace(logger, "Queue not empty after termination");
while (flushABuffer()) {
// no-op
}
if (queue.isEmpty()) {
completed = true;
if (this.error != null) {
actual.onError(this.error);
}
else {
actual.onComplete();
}
} else {
if (logger != null) {
trace(logger, "Queue not empty after termination");
}
}
}
}
Expand Down