Skip to content

Commit 923df9b

Browse files
authored
fix FlowController.acquire error (#147)
1 parent e34f72b commit 923df9b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

client/src/main/kotlin/io/hstream/impl/BufferedProducerKtImpl.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,14 @@ class BufferedProducerKtImpl(
184184
leftBytes -= bytes
185185
null
186186
} else {
187-
val waitBytes = bytes - leftBytes
187+
val waitBytes =
188+
if (leftBytes == 0) {
189+
bytes
190+
} else {
191+
val waitBytes = bytes - leftBytes
192+
leftBytes = 0
193+
waitBytes
194+
}
188195
val bytesWaiter = BytesWaiter(waitBytes)
189196
waitingList.addLast(bytesWaiter)
190197
bytesWaiter

0 commit comments

Comments
 (0)