You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the session extending mechanism triggers, it also triggers a timeout for the second half of its duration, listening for clicks and mouse moves. When in the middle of the second half of the expiration delay, moving the mouse does:
Expected behavior
Triggers a single call to the /session endpoint.
Current behavior
Triggers 2 to 3 calls to the /session endpoint, with the frontend and the backend on the same machine. Could be a pain on a laggy network and/or with a server under load.
Possible solution
In the code bellow:
varextendSession=function(){/*** SUGGESTED CHANGE HERE *** shouldRecordAction = false; *** SUGGESTED CHANGE HERE ***/$.ajax({url: countlyGlobal.path+"/session",success: function(result){if(result==="logout"){$("#user-logout").click();}if(result==="login"){$("#user-logout").click();window.location="/login";}elseif(result==="success"){shouldRecordAction=false;varmyTimeoutValue=parseInt(countlyGlobal.config.session_timeout)*1000*60;if(myTimeoutValue>2147483647){//max value used by set timeout functionmyTimeoutValue=1800000;//30 minutes}setTimeout(function(){shouldRecordAction=true;},Math.round(myTimeoutValue/2));resetSessionTimeouts(myTimeoutValue);}}/*** SUGGESTED CHANGE HERE *** , error: function() { shouldRecordAction = true; } *** SUGGESTED CHANGE HERE ***/});};
...
$(document).on("click mousemove extend-dashboard-user-session",function(){if(shouldRecordAction){extendSession();}});
No matter the /session always return 200, one is never protected against network failure, checking for errors is always a good thing.
Steps to reproduce
Open the dev tools in the browser on the Network tab (optionally filter on session)
Set session expiration to 1 minute (the smallest unit of time possible)
A bit before reaching 30 seconds, move the mouse like crazy
See the Network tab for what score you can get ;)
The text was updated successfully, but these errors were encountered:
When the session extending mechanism triggers, it also triggers a timeout for the second half of its duration, listening for clicks and mouse moves. When in the middle of the second half of the expiration delay, moving the mouse does:
Expected behavior
Triggers a single call to the
/session
endpoint.Current behavior
Triggers 2 to 3 calls to the
/session
endpoint, with the frontend and the backend on the same machine. Could be a pain on a laggy network and/or with a server under load.Possible solution
In the code bellow:
No matter the
/session
always return 200, one is never protected against network failure, checking for errors is always a good thing.Steps to reproduce
session
)The text was updated successfully, but these errors were encountered: