summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-02-21 08:18:29 +0100
committerOskar Nyberg <oskar@mullvad.net>2023-02-21 08:18:29 +0100
commita83211930c6473776d2e838e357cc5583000aa9f (patch)
treed2d9eddac85e019fbc6cd8bf8b6efa615b57d09a
parent92aa85b77adcf4694d1b309296fcd1315ea8ebc3 (diff)
parentfaa07fbcda7650c4df5f7e5680a78362e1d90fbf (diff)
downloadmullvadvpn-a83211930c6473776d2e838e357cc5583000aa9f.tar.xz
mullvadvpn-a83211930c6473776d2e838e357cc5583000aa9f.zip
Merge branch 'fix-timeout-duration'
-rw-r--r--gui/src/main/account.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/gui/src/main/account.ts b/gui/src/main/account.ts
index 0b992cee88..768126e566 100644
--- a/gui/src/main/account.ts
+++ b/gui/src/main/account.ts
@@ -225,8 +225,9 @@ export default class Account {
const expiry = new Date(this.accountData.expiry).getTime();
const now = new Date().getTime();
const threeDays = 3 * 24 * 60 * 60 * 1000;
- // Add 10 seconds to be on the safe side
- const timeout = expiry - now - threeDays + 10_000;
+ // Add 10 seconds to be on the safe side. Never make it longer than a 24 days since
+ // the timeout needs to fit into a signed 32-bit integer.
+ const timeout = Math.min(expiry - now - threeDays + 10_000, 24 * 24 * 60 * 60 * 1000);
this.firstExpiryNotificationScheduler.schedule(() => this.handleAccountExpiry(), timeout);
}
}