mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-16 16:40:06 +00:00
fix(session-expiry-retry): retry job with new session when current session has expired
This commit is contained in:
@@ -206,9 +206,9 @@ export class SASViyaApiClient {
|
|||||||
silent = false,
|
silent = false,
|
||||||
data = null,
|
data = null,
|
||||||
debug = false
|
debug = false
|
||||||
) {
|
): Promise<any> {
|
||||||
silent = !debug;
|
silent = !debug;
|
||||||
|
try {
|
||||||
const headers: any = {
|
const headers: any = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
};
|
};
|
||||||
@@ -311,7 +311,9 @@ export class SASViyaApiClient {
|
|||||||
{
|
{
|
||||||
headers,
|
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") {
|
if (jobStatus === "failed" || jobStatus === "error") {
|
||||||
@@ -332,12 +334,21 @@ export class SASViyaApiClient {
|
|||||||
await this.sessionManager.clearSession(executionSessionId, accessToken);
|
await this.sessionManager.clearSession(executionSessionId, accessToken);
|
||||||
|
|
||||||
return { result: jobResult?.result, log };
|
return { result: jobResult?.result, log };
|
||||||
// } else {
|
} catch (e) {
|
||||||
// console.error(
|
if (e && e.status === 404) {
|
||||||
// `Unable to find execution context ${contextName}.\nPlease check the contextName in the tgtDeployVars and try again.`
|
return this.executeScript(
|
||||||
// );
|
jobName,
|
||||||
// console.error("Response from server: ", JSON.stringify(this.contexts));
|
linesOfCode,
|
||||||
// }
|
contextName,
|
||||||
|
accessToken,
|
||||||
|
silent,
|
||||||
|
data,
|
||||||
|
debug
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user