Skip to content

Commit

Permalink
Fix TableViewportSubscription race condition (deephaven#3252)
Browse files Browse the repository at this point in the history
- Race condition was causing UI error with selectDistinct
- TableViewportSubscription could initialize after it had already been closed
- Check the status to see if we're already DONE before initializing
- Close table if we're already DONE
- Fixes deephaven#3251
  • Loading branch information
mofojed authored Jan 3, 2023
1 parent 849f7a1 commit 8d1e790
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,13 @@ public TableViewportSubscription(double firstRow, double lastRow, Column[] colum
this.original = existingTable;
this.originalState = original.state();
copy = existingTable.copy(false).then(table -> new Promise<>((resolve, reject) -> {

// Wait until the state is running to copy it
originalState.onRunning(newState -> {
if (this.status == Status.DONE) {
JsLog.debug("TableViewportSubscription closed before originalState.onRunning completed, ignoring");
table.close();
return;
}
table.batch(batcher -> {
batcher.customColumns(newState.getCustomColumns());
batcher.filter(newState.getFilters());
Expand Down

0 comments on commit 8d1e790

Please sign in to comment.