Skip to content

Commit

Permalink
Merge pull request #443 from KxSystems/KXI-38329
Browse files Browse the repository at this point in the history
KXI-38329 - ping for a scratchpad when connecting to insights
  • Loading branch information
Philip-Carneiro-KX authored Oct 17, 2024
2 parents 62bf740 + f5d7833 commit d11a299
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 23 additions & 10 deletions src/classes/insightsConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class InsightsConnection {
if (token) {
await this.getConfig();
await this.getMeta();
await this.getScratchpadQuery("");
}
});
return this.connected;
Expand Down Expand Up @@ -447,18 +448,30 @@ export class InsightsConnection {
httpsAgent: getHttpsAgent(this.node.details.insecure),
})
.then((response: any) => {
kdbOutputLog(`[SCRATCHPAD] Status: ${response.status}`, "INFO");
if (isTableView && !response.data.error) {
const buffer = new Uint8Array(
response.data.data.map((x: string) => parseInt(x, 16)),
).buffer;

response.data.data = handleWSResults(buffer);
response.data.data = handleScratchpadTableRes(
response.data.data,
if (response.data.error) {
kdbOutputLog(
`[SCRATCHPAD] Error occured while executing scratchpad: ${response.data.errorMsg}`,
"ERROR",
);
} else if (query === "") {
kdbOutputLog(
`[SCRATCHPAD] scratchpad created for connection: ${this.connLabel}`,
"INFO",
);
} else {
kdbOutputLog(`[SCRATCHPAD] Status: ${response.status}`, "INFO");
if (isTableView && !response.data.error) {
const buffer = new Uint8Array(
response.data.data.map((x: string) => parseInt(x, 16)),
).buffer;

response.data.data = handleWSResults(buffer);
response.data.data = handleScratchpadTableRes(
response.data.data,
);
}
return response.data;
}
return response.data;
});
return spRes;
},
Expand Down

0 comments on commit d11a299

Please sign in to comment.