FS: Only attempt session rotation if expiration cookie exists (#115824)

don't attempt rotation if no expiration cookie exists
This commit is contained in:
Ashley Harrison
2026-01-05 15:27:35 +00:00
committed by GitHub
parent 5698f2d039
commit e310d5e8ee
+6 -3
View File
@@ -250,11 +250,14 @@
}
}
return null;
return undefined;
}
function getSessionExpiration() {
const value = getCookie("grafana_session_expiry") || "0";
const value = getCookie("grafana_session_expiry");
if (!value) {
return undefined;
}
const realExpiresSeconds = parseInt(value, 10);
const expiresSeconds = Math.max(realExpiresSeconds - 10, 0); // Rotate 10s before the real expiration
const expiration = new Date(expiresSeconds * 1000);
@@ -332,7 +335,7 @@
const now = new Date();
// If the session has expired, don't continue trying to fetch boot data
if (now >= sessionExpiration) {
if (sessionExpiration && now >= sessionExpiration) {
await rotateSession();
}
} catch (error) {