Skip to content

Commit

Permalink
Properly pass along exceptional state in BatchHandler
Browse files Browse the repository at this point in the history
This is in support of deephaven#4798. While this _is_ a fix to BatchHandler logic, it isn't the underlying cause of 4798. Next time 4798 is triggered in CI though, we should have more details to go off of.
  • Loading branch information
devinrsmith committed Nov 9, 2023
1 parent 68b63b2 commit 0e501d3
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ public void onCompleted() {
private static final class BatchHandler
implements StreamObserver<ExportedTableCreationResponse> {

private static final Logger log = LoggerFactory.getLogger(BatchHandler.class);

private final Map<Integer, State> newStates;

private BatchHandler(Map<Integer, State> newStates) {
Expand All @@ -398,11 +400,16 @@ public void onNext(ExportedTableCreationResponse value) {
"Not expecting export creation responses for empty tickets");
}
final int exportId = ExportTicketHelper.ticketToExportId(value.getResultId().getTicket(), "export");
final State state = newStates.remove(exportId);
final State state = newStates.get(exportId);
if (state == null) {
throw new IllegalStateException("Unable to find state for creation response");
}
state.onCreationResponse(value);
try {
state.onCreationResponse(value);
} catch (RuntimeException e) {
log.error("state.onCreationResponse had unexpected exception", e);
state.onCreationError(e);
}
}

@Override
Expand Down

0 comments on commit 0e501d3

Please sign in to comment.