Skip to content

Commit

Permalink
chore: attempt to drain the stream iterator
Browse files Browse the repository at this point in the history
Related #2696
  • Loading branch information
BenWhitehead committed Sep 10, 2024
1 parent 1855308 commit 96e4049
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,23 @@ public ReadObjectResponse next() {
@Override
public void close() {
if (serverStream != null) {
// todo: do we need to "drain" anything?
serverStream.cancel();
if (responseIterator != null) {
IOException ioException = null;
while (responseIterator.hasNext()) {
try {
ReadObjectResponse next = responseIterator.next();
ResponseContentLifecycleHandle handle = rclm.get(next);
handle.close();
} catch (IOException e) {
if (ioException == null) {
ioException = e;
} else {
ioException.addSuppressed(e);
}
}
}
}
}
}

Expand Down

0 comments on commit 96e4049

Please sign in to comment.