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:
parent
aab0b0b4bf
commit
8bb7b2e88b
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user