1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 09:24:35 +00:00

fix(session-expiry-retry): retry job with new session when current session has expired

This commit is contained in:
Krishna Acondy
2020-08-18 20:23:59 +01:00
parent 4e2b6d32cc
commit 75a11cdff4

View File

@@ -206,9 +206,9 @@ export class SASViyaApiClient {
silent = false,
data = null,
debug = false
) {
): Promise<any> {
silent = !debug;
try {
const headers: any = {
"Content-Type": "application/json",
};
@@ -311,11 +311,13 @@ export class SASViyaApiClient {
{
headers,
}
).then((res: any) => res.result.items.map((i: any) => i.line).join("\n"));
).then((res: any) =>
res.result.items.map((i: any) => i.line).join("\n")
);
}
if (jobStatus === "failed" || jobStatus === "error") {
return Promise.reject({error: currentJob.error, log: log});
return Promise.reject({ error: currentJob.error, log: log });
}
const resultLink = `/compute/sessions/${executionSessionId}/filerefs/_webout/content`;
@@ -332,12 +334,21 @@ export class SASViyaApiClient {
await this.sessionManager.clearSession(executionSessionId, accessToken);
return { result: jobResult?.result, log };
// } else {
// console.error(
// `Unable to find execution context ${contextName}.\nPlease check the contextName in the tgtDeployVars and try again.`
// );
// console.error("Response from server: ", JSON.stringify(this.contexts));
// }
} catch (e) {
if (e && e.status === 404) {
return this.executeScript(
jobName,
linesOfCode,
contextName,
accessToken,
silent,
data,
debug
);
} else {
throw e;
}
}
}
/**