Skip to content

Commit

Permalink
fix(s3stream): remove future before complete it to prevent infinite r… (
Browse files Browse the repository at this point in the history
#830)

Signed-off-by: Shichao Nie <[email protected]>
  • Loading branch information
SCNieh authored Dec 13, 2023
1 parent 72d34d8 commit d1cdb6b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ CompletableFuture<Void> getDataBlockIndices(long streamId, long endOffset, ReadC
}

private void completeInflightTask(DefaultS3BlockCache.ReadAheadTaskKey key, Throwable ex) {
inflightReadAheadTaskMap.computeIfPresent(key, (k, v) -> {
CompletableFuture<Void> cf = inflightReadAheadTaskMap.remove(key);
if (cf != null) {
if (ex != null) {
v.completeExceptionally(ex);
cf.completeExceptionally(ex);
} else {
v.complete(null);
cf.complete(null);
}
return null;
});
}
}

private List<Pair<ObjectReader, StreamDataBlock>> collectStreamDataBlocksToRead(ReadContext context) {
Expand Down

0 comments on commit d1cdb6b

Please sign in to comment.