Skip to content
Snippets Groups Projects
Commit 9710b408 authored by Christian ZHENG's avatar Christian ZHENG
Browse files

refactor(login): rename method

parent a8c721ec
Branches
Tags
2 merge requests!14feat: added mounted, .bashrc, .zshrc, added tests, added keycloak tests,!8feat(extension): login, open in devcontainer, automaticly save code, open briefing, publish extension
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}`);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment