diff --git a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts index ea199dd32efb4894aa60ec11476e335d7f7655d9..40e8dbbe100905f60b0baa0dd0dc42c835449106 100644 --- a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts +++ b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts @@ -1,8 +1,8 @@ import * as https from 'https'; import fetch, { Response } from 'node-fetch'; -import { error as err, error, log } from '../recorder/utils'; import { HttpStatusCode } from '../customTypings/HttpStatusCode'; import { TokenFetchErrorCode } from '../customTypings/KeycloakAPITypes'; +import { error as err, log } from '../recorder/utils'; process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; // TODO: remove when SSL will work @@ -164,12 +164,12 @@ export default class KeycloakOAuth2DeviceFlowConnection { } case TokenFetchErrorCode.authorization_pending: { // I have to keep this `await sleep` and the while in the same function context - await sleep(this._waitDuration.getDuration()); + await sleep(this._waitDuration.getCurrentDuration()); continue; } case TokenFetchErrorCode.slow_down: { this._waitDuration.increase(); - await sleep(this._waitDuration.getDuration()); + await sleep(this._waitDuration.getCurrentDuration()); break; } default: { @@ -238,7 +238,7 @@ class WaitDuration { this._durations.sort(); this._index = 0; } - public getDuration(): number { + public getCurrentDuration(): number { if (this._index >= this._durations.length - 1) { throw new Error(`Index out of bounds. Current index: ${this._index} | Max val: ${this._durations.length - 1}`); }