diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-07-06 19:07:34 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-08 13:23:30 +0200 |
| commit | 0623490815c5b9377be1c1bb266c4e34d2fc1980 (patch) | |
| tree | c7791e2c65169e28a4ce88a3718aaf515e0393b1 /gui/src | |
| parent | 91a30f07505eaea3f4669ba874ee497af43d89a3 (diff) | |
| download | mullvadvpn-0623490815c5b9377be1c1bb266c4e34d2fc1980.tar.xz mullvadvpn-0623490815c5b9377be1c1bb266c4e34d2fc1980.zip | |
Remove periodic account data fetch when account has expired
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/account-data-cache.ts | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/gui/src/main/account-data-cache.ts b/gui/src/main/account-data-cache.ts index 8b81a29472..74e89b923a 100644 --- a/gui/src/main/account-data-cache.ts +++ b/gui/src/main/account-data-cache.ts @@ -1,4 +1,4 @@ -import { closeToExpiry, hasExpired } from '../shared/account-expiry'; +import { closeToExpiry } from '../shared/account-expiry'; import { AccountToken, IAccountData, VoucherResponse } from '../shared/daemon-rpc-types'; import { DateComponent, dateByAddingComponent } from '../shared/date-helper'; import log from '../shared/logging'; @@ -6,8 +6,6 @@ import consumePromise from '../shared/promise'; import { Scheduler } from '../shared/scheduler'; import { InvalidAccountError } from './errors'; -const EXPIRED_ACCOUNT_REFRESH_PERIOD = 60_000; - interface IAccountFetchWatcher { onFinish: () => void; onError: (error: Error) => void; @@ -113,9 +111,7 @@ export default class AccountDataCache { const currentDate = new Date(); const oneMinuteBeforeExpiry = dateByAddingComponent(accountExpiry, DateComponent.minute, -1); - if (hasExpired(accountExpiry)) { - return EXPIRED_ACCOUNT_REFRESH_PERIOD; - } else if (oneMinuteBeforeExpiry >= currentDate && closeToExpiry(accountExpiry)) { + if (oneMinuteBeforeExpiry >= currentDate && closeToExpiry(accountExpiry)) { return oneMinuteBeforeExpiry.getTime() - currentDate.getTime(); } else { return undefined; |
