Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-33199 Workunits not handling ESP Exceptions #19404

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions esp/src/src-react/comms/workunit.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { Workunit, WorkunitsService, type WsWorkunits } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
import { Thenable } from "src/store/Deferred";
import { Paged } from "src/store/Paged";
import { BaseStore } from "src/store/Store";
import { wuidToDateTime } from "src/Utility";

const logger = scopedLogger("src-react/comms/workunit.ts");

const service = new WorkunitsService({ baseUrl: "" });

export type WUQueryStore = BaseStore<WsWorkunits.WUQuery, Workunit>;
Expand Down Expand Up @@ -65,6 +69,16 @@ export function CreateWUQueryStore(): BaseStore<WsWorkunits.WUQuery, Workunit> {
data,
total: response.NumWUs
};
}).catch(e => {
if (e.Exception && e.Exception[0] && e.Exception[0].Message === nlsHPCC.GridAbortMessage) {
logger.debug(e.Exception[0].Message);
} else {
logger.error(e);
}
return {
data: [],
total: 0
};
});
});
return store;
Expand Down
8 changes: 4 additions & 4 deletions esp/src/src-react/components/controls/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ const FluentStoreGrid: React.FunctionComponent<FluentStoreGridProps> = ({

const abortController = React.useRef<AbortController>();

React.useEffect(() => {
useDeepEffect(() => {
if (abortController.current) {
abortController.current.abort({ message: "Grid aborting stale request" });
abortController.current.abort({ message: nlsHPCC.GridAbortMessage });
}
abortController.current = new AbortController();
}, [query]);
}, [], [query, sorted]);

const refreshTable = useDeepCallback((clearSelection = false) => {
if (isNaN(start) || isNaN(count)) return;
Expand All @@ -260,7 +260,7 @@ const FluentStoreGrid: React.FunctionComponent<FluentStoreGridProps> = ({
setItems(items);
selectedIndices.forEach(index => selectionHandler.setIndexSelected(index, true, false));
});
}, [abortController?.current?.signal, count, selectionHandler, start, store], [query, sorted]);
}, [count, selectionHandler, start, store], [query, sorted]);

React.useEffect(() => {
// Dummy line to ensure its included in the dependency array ---
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/util/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function parseSort(_?: string): QuerySortItem | undefined {
}

export function updateSort(sorted: boolean, descending: boolean, sortBy: string) {
updateParam("sortBy", sorted ? (descending ? "-" : "") + sortBy : undefined);
updateParam("sortBy", sorted ? (descending ? "-" : "") + sortBy : null); // null to remove param...
}

export function parsePage(_: string): number {
Expand Down
1 change: 1 addition & 0 deletions esp/src/src/nls/hpcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ export = {
Graphs: "Graphs",
GraphControl: "Graph Control",
GraphView: "Graph View",
GridAbortMessage: "Grid aborting stale request",
Group: "Group",
GroupBy: "Group By",
Grouping: "Grouping",
Expand Down
Loading