wankai123 commented on code in PR #13544:
URL: https://github.com/apache/skywalking/pull/13544#discussion_r2431547953
##########
oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/bulk/BulkProcessor.java:
##########
@@ -132,13 +136,16 @@ public void flush() {
log.error("Interrupted when trying to get semaphore to execute
bulk requests", e);
return;
}
-
+ HistogramMetrics.Timer timer = bulkMetrics.createTimer();
final List<Holder> batch = new ArrayList<>(requests.size());
requests.drainTo(batch);
final List<CompletableFuture<Void>> futures = doFlush(batch);
final CompletableFuture<Void> future = CompletableFuture.allOf(
futures.toArray(new CompletableFuture[futures.size()]));
- future.whenComplete((v, t) -> semaphore.release());
+ future.whenComplete((v, t) -> {
+ timer.close();
+ semaphore.release();
+ });
future.join();
lastFlushTS = System.currentTimeMillis();
Review Comment:
It's an asynchronous call, will always catch by future.whenComplete.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]