1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-10 22:00:05 +00:00

chore(streamlog): optimise polling mechanism

This commit is contained in:
Krishna Acondy
2021-07-20 09:25:39 +01:00
parent 1594f0c7db
commit 5c8d311ae8
14 changed files with 624 additions and 230 deletions

View File

@@ -754,18 +754,16 @@ export class SASViyaApiClient {
jobDefinition,
arguments: jobArguments
}
const { result: postedJob, etag } = await this.requestClient.post<Job>(
const { result: postedJob } = await this.requestClient.post<Job>(
`${this.serverUrl}/jobExecution/jobs?_action=wait`,
postJobRequestBody,
access_token
)
const jobStatus = await this.pollJobState(
postedJob,
etag,
authConfig
).catch((err) => {
throw prefixMessage(err, 'Error while polling job status. ')
})
const jobStatus = await this.pollJobState(postedJob, authConfig).catch(
(err) => {
throw prefixMessage(err, 'Error while polling job status. ')
}
)
const { result: currentJob } = await this.requestClient.get<Job>(
`${this.serverUrl}/jobExecution/jobs/${postedJob.id}`,
access_token
@@ -833,7 +831,6 @@ export class SASViyaApiClient {
private async pollJobState(
postedJob: Job,
etag: string | null,
authConfig?: AuthConfig,
pollOptions?: PollOptions
) {
@@ -841,7 +838,6 @@ export class SASViyaApiClient {
this.requestClient,
postedJob,
this.debug,
etag,
authConfig,
pollOptions
)