Skip to content

Commit 08404d6

Browse files
sugmanuerhernandez35
authored andcommitted
Check that we have demand before requesting from upstram
1 parent 0e68258 commit 08404d6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

client/client-http/src/main/java/software/amazon/smithy/java/client/http/HttpClientDataStream.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ private void drain() {
121121
private void drainAndRequest() {
122122
drain();
123123

124-
if (queue.isEmpty() && !senderFinished.get()) {
125-
upstreamSubscription.request(demand.get());
124+
var currentDemand = demand.get();
125+
if (currentDemand > 0 && queue.isEmpty() && !senderFinished.get()) {
126+
upstreamSubscription.request(currentDemand);
126127
}
127128
}
128129
}

0 commit comments

Comments
 (0)