summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-07-06 19:11:22 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-07-08 13:23:30 +0200
commit80eb29423392d35d0add0392144aa40fa94fbf7e (patch)
tree831e2e68cce78fb9f4a12ce461b81afb6654a28d /gui/src
parent0623490815c5b9377be1c1bb266c4e34d2fc1980 (diff)
downloadmullvadvpn-80eb29423392d35d0add0392144aa40fa94fbf7e.tar.xz
mullvadvpn-80eb29423392d35d0add0392144aa40fa94fbf7e.zip
Rename variables and function names in account data cache
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/account-data-cache.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/gui/src/main/account-data-cache.ts b/gui/src/main/account-data-cache.ts
index 74e89b923a..9a3df33d35 100644
--- a/gui/src/main/account-data-cache.ts
+++ b/gui/src/main/account-data-cache.ts
@@ -15,7 +15,7 @@ interface IAccountFetchWatcher {
// cached value for 1 minute.
export default class AccountDataCache {
private currentAccount?: AccountToken;
- private expiresAt?: Date;
+ private validUntil?: Date;
private performingFetch = false;
private waitStrategy = new WaitStrategy();
private fetchRetryScheduler = new Scheduler();
@@ -34,7 +34,7 @@ export default class AccountDataCache {
}
// Only fetch if value has expired
- if (this.isExpired()) {
+ if (!this.isValid()) {
if (watcher) {
this.watchers.push(watcher);
}
@@ -57,7 +57,7 @@ export default class AccountDataCache {
this.waitStrategy.reset();
this.performingFetch = false;
- this.expiresAt = undefined;
+ this.validUntil = undefined;
this.updateHandler();
this.notifyWatchers((watcher) => {
watcher.onError(new Error('Cancelled'));
@@ -71,13 +71,13 @@ export default class AccountDataCache {
}
private setValue(value: IAccountData) {
- this.expiresAt = new Date(Date.now() + 60 * 1000); // 60s expiration
+ this.validUntil = new Date(Date.now() + 60 * 1000); // 60s expiration
this.updateHandler(value);
this.notifyWatchers((watcher) => watcher.onFinish());
}
- private isExpired() {
- return !this.expiresAt || this.expiresAt < new Date();
+ private isValid() {
+ return this.validUntil && this.validUntil > new Date();
}
private async performFetch(accountToken: AccountToken) {