in sdk-java/src/main/java/com/spotify/confidence/EventSenderEngineImpl.java [130:149]
private void upload(List<com.spotify.confidence.events.v1.Event> events) {
if (events.isEmpty()) return;
final CompletableFuture<Boolean> batchUploaded =
uploadExecutor.getStageAsync(
() -> {
// we don't want to upload if the thread was interrupted on close
if (joinWasInterrupted) {
return CompletableFuture.completedFuture(true);
}
return eventUploader.upload(events);
});
pendingBatches.add(batchUploaded);
batchUploaded.whenComplete(
(res, err) -> {
// Errors from this is logged by the uploader
pendingBatches.remove(batchUploaded);
estimatedMemoryConsumption.addAndGet(
-events.stream().mapToLong(Event::getSerializedSize).sum());
});
}