Skip to content

Commit

Permalink
fix(java-toolkit): close reader when failed
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKian committed May 29, 2024
1 parent e083182 commit f40764f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,16 @@ public void handleInternal(Consumer<SinkRecordBatch> handler, boolean parallel)
}
retry = 0;
} catch (Exception e) {
log.error("read records failed, retry:{}, ", retry, e);
log.error("read records from shard {} failed, retry:{}, ", shard.getShardId(), retry, e);
retry++;
if (retry > maxRetry) {
throw new RuntimeException("retry failed");
}
Thread.sleep(retry * 3000L);
reader = null;
if (reader != null) {
reader.close();
reader = null;
}
}
}
} catch (Exception e) {
Expand Down

0 comments on commit f40764f

Please sign in to comment.