Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions client/src/main/java/io/hstream/impl/ProducerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,18 @@ private void flush() {
logger.info("start flush recordBuffer, current buffer size is: {}", recordBufferCount);

writeHStreamRecords(recordBuffer)
.thenAccept(
recordIds -> {
for (int i = 0; i < recordIds.size(); ++i) {
futures.get(i).complete(recordIds.get(i));
.handle(
(recordIds, exception) -> {
if (exception == null) {
for (int i = 0; i < recordIds.size(); ++i) {
futures.get(i).complete(recordIds.get(i));
}
} else {
for (int i = 0; i < futures.size(); ++i) {
futures.get(i).completeExceptionally(exception);
}
}
return null;
})
.join();

Expand Down Expand Up @@ -125,7 +132,8 @@ public void onNext(AppendResponse appendResponse) {

@Override
public void onError(Throwable t) {
throw new HStreamDBClientException(t);
logger.warn("write records error: ", t);
completableFuture.completeExceptionally(new HStreamDBClientException(t));
}

@Override
Expand Down