From 6d166efd111580f03c685992fd81a06612b00be3 Mon Sep 17 00:00:00 2001 From: Yury Shkoda Date: Mon, 30 Nov 2020 12:27:09 +0300 Subject: [PATCH] feat(pollJobState): made pollOptions optional and updated docs --- src/SASViyaApiClient.ts | 8 ++++---- src/types/PollOptions.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SASViyaApiClient.ts b/src/SASViyaApiClient.ts index faee443..20f4294 100644 --- a/src/SASViyaApiClient.ts +++ b/src/SASViyaApiClient.ts @@ -957,7 +957,7 @@ export class SASViyaApiClient { * @param accessToken - an optional access token for an authorized user. * @param waitForResult - a boolean indicating if the function should wait for a result. * @param expectWebout - a boolean indicating whether to expect a _webout response. - * @param pollOptions - an object that represents poll interval and maximum amount of attempts. + * @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }. */ public async executeComputeJob( sasJob: string, @@ -1252,12 +1252,12 @@ export class SASViyaApiClient { accessToken?: string, pollOptions?: PollOptions ) { - let MAX_POLL_COUNT = 1000 let POLL_INTERVAL = 100 + let MAX_POLL_COUNT = 1000 if (pollOptions) { - MAX_POLL_COUNT = pollOptions.MAX_POLL_COUNT - POLL_INTERVAL = pollOptions.POLL_INTERVAL + POLL_INTERVAL = pollOptions.POLL_INTERVAL || POLL_INTERVAL + MAX_POLL_COUNT = pollOptions.MAX_POLL_COUNT || MAX_POLL_COUNT } let postedJobState = '' diff --git a/src/types/PollOptions.ts b/src/types/PollOptions.ts index c4ab7a0..0472f0c 100644 --- a/src/types/PollOptions.ts +++ b/src/types/PollOptions.ts @@ -1,4 +1,4 @@ export interface PollOptions { - MAX_POLL_COUNT: number - POLL_INTERVAL: number + MAX_POLL_COUNT?: number + POLL_INTERVAL?: number }