Reduce the time when getRemainingTimeoutSeconds request is made from 30s to 20s, so fewer calls are made

This commit is contained in:
Elitsa
2024-08-21 14:44:09 +02:00
committed by Nikolaj Geisle
parent 67a71f8f82
commit c9021ab2d2

View File

@@ -65,17 +65,17 @@ angular.module('umbraco.services')
//countdown by 5 seconds since that is how long our timer is for.
currentUser.remainingAuthSeconds -= 5;
//if there are more than 30 remaining seconds, recurse!
if (currentUser.remainingAuthSeconds > 30) {
//if there are more than 20 remaining seconds, recurse!
if (currentUser.remainingAuthSeconds > 20) {
//we need to check when the last time the timeout was set from the server, if
// it has been more than 30 seconds then we'll manually go and retrieve it from the
// it has been more than 20 seconds then we'll manually go and retrieve it from the
// server - this helps to keep our local countdown in check with the true timeout.
if (lastServerTimeoutSet != null) {
var now = new Date();
var seconds = (now.getTime() - lastServerTimeoutSet.getTime()) / 1000;
if (seconds > 30) {
if (seconds > 20) {
//first we'll set the lastServerTimeoutSet to null - this is so we don't get back in to this loop while we
// wait for a response from the server otherwise we'll be making double/triple/etc... calls while we wait.
@@ -116,7 +116,7 @@ angular.module('umbraco.services')
countdownUserTimeout();
}
else {
//we've got less than 30 seconds remaining so let's check the server
//we've got less than 20 seconds remaining so let's check the server
if (lastServerTimeoutSet != null) {
//first we'll set the lastServerTimeoutSet to null - this is so we don't get back in to this loop while we