From 9710b408d0963fc04b2f54d1048e4d651fb5d45c Mon Sep 17 00:00:00 2001
From: Christian Zheng <czheng@takima.fr>
Date: Thu, 14 Apr 2022 15:25:58 +0200
Subject: [PATCH] refactor(login): rename method

---
 .../src/core/keycloakOAuth2DeviceFlowConnection.ts        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts
index ea199dd3..40e8dbbe 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}`);
     }
-- 
GitLab