Skip to content

Commit

Permalink
Try closing channels for failed ops
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarge committed Sep 26, 2024
1 parent 118d164 commit e6cabfa
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,15 +419,15 @@ protected int submit(final List<O> ops, final int from, final int to)
LogUtil.exception(Level.WARN, e, "Failed to lease the connection for the load operation");
nextOp.status(Operation.Status.FAIL_IO);
complete(conn, nextOp);
if (permits - n - 1 > 0) {
if (permits - n > 1) {
concurrencyThrottle.release(permits - n - 1);
}
} catch (final Throwable thrown) {
throwUncheckedIfInterrupted(thrown);
LogUtil.exception(Level.WARN, thrown, "Failed to submit the load operations");
nextOp.status(Operation.Status.FAIL_UNKNOWN);
complete(conn, nextOp);
if (permits - n - 1 > 0) {
if (permits - n > 1) {
concurrencyThrottle.release(permits - n - 1);
}
}
Expand Down Expand Up @@ -595,6 +595,9 @@ public void complete(final Channel channel, final O op) {
} catch (final IllegalStateException e) {
LogUtil.exception(Level.DEBUG, e, "{}: invalid load operation state", op.toString());
}
if (op.status() != Operation.Status.SUCC) {
channel.close();
}
if (!channel.attr(ATTR_KEY_RELEASED).get()) {
concurrencyThrottle.release();
if (channel != null) {
Expand Down

0 comments on commit e6cabfa

Please sign in to comment.