Skip to content

Commit d46895e

Browse files
committed
do not account for pending bytes when auto-flushing bytes is disabled
1 parent 5b1070b commit d46895e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

core/src/main/java/io/questdb/client/cutlass/qwp/client/QwpWebSocketSender.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,9 +1298,13 @@ private void sealAndSwapBuffer() {
12981298
*/
12991299
private void sendRow() {
13001300
ensureConnected();
1301-
long bytesBefore = currentTableBuffer.getBufferedBytes();
1302-
currentTableBuffer.nextRow();
1303-
pendingBytes += currentTableBuffer.getBufferedBytes() - bytesBefore;
1301+
if (autoFlushBytes > 0) {
1302+
long bytesBefore = currentTableBuffer.getBufferedBytes();
1303+
currentTableBuffer.nextRow();
1304+
pendingBytes += currentTableBuffer.getBufferedBytes() - bytesBefore;
1305+
} else {
1306+
currentTableBuffer.nextRow();
1307+
}
13041308

13051309
// Both modes: accumulate rows, don't encode yet
13061310
if (pendingRowCount == 0) {

core/src/test/java/io/questdb/client/test/cutlass/line/tcp/v4/QwpAllocationTestClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private static Sender createSender(
209209
.address(host)
210210
.port(port);
211211
if (batchSize > 0) wsBuilder.autoFlushRows(batchSize);
212-
if (flushBytes > 0) wsBuilder.autoFlushBytes(flushBytes);
212+
if (flushBytes >= 0) wsBuilder.autoFlushBytes(flushBytes);
213213
if (flushIntervalMs > 0) wsBuilder.autoFlushIntervalMillis((int) flushIntervalMs);
214214
if (inFlightWindow > 0) wsBuilder.inFlightWindowSize(inFlightWindow);
215215
return wsBuilder.build();

0 commit comments

Comments
 (0)