1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure session expiry timeout doesn't exceed limit

This commit is contained in:
Nick O'Leary 2019-07-06 16:34:48 +01:00
parent aab0b0b4bf
commit 8bb7b2e88b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -56,7 +56,7 @@ function expireSessions() {
} }
if (nextExpiry < Number.MAX_SAFE_INTEGER) { if (nextExpiry < Number.MAX_SAFE_INTEGER) {
// Allow 5 seconds grace // Allow 5 seconds grace
expiryTimeout = setTimeout(expireSessions,(nextExpiry - Date.now()) + 5000) expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(nextExpiry - Date.now()) + 5000))
} }
if (modified) { if (modified) {
return storage.saveSessions(sessions); return storage.saveSessions(sessions);
@ -129,7 +129,7 @@ module.exports = {
sessions[accessToken] = session; sessions[accessToken] = session;
if (!expiryTimeout) { if (!expiryTimeout) {
expiryTimeout = setTimeout(expireSessions,(accessTokenExpiresAt - Date.now()) + 5000) expiryTimeout = setTimeout(expireSessions,Math.min(2147483647,(accessTokenExpiresAt - Date.now()) + 5000))
} }
return storage.saveSessions(sessions).then(function() { return storage.saveSessions(sessions).then(function() {