File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
js/apps/system/_admin/aardvark/APP/frontend/js/views Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 5656 // only try to renew token if we are still online
5757 return ;
5858 }
59+
60+ var frac = ( frontendConfig . sessionTimeout >= 1800 ) ? 0.95 : 0.8 ;
61+ // threshold for renewal: once session is x% over
62+ var renewalThreshold = frontendConfig . sessionTimeout * frac ;
5963
6064 var now = Date . now ( ) / 1000 ;
6165 var lastActivity = arangoHelper . lastActivity ( ) ;
6266
63- if ( lastActivity > 0 && ( now - lastActivity ) > 90 * 60 ) {
67+ // seconds in which the last user activity counts as significant
68+ var lastSignificantActivityTimePeriod = 90 * 60 ;
69+
70+ // if this is more than the renewal threshold, limit it
71+ if ( lastSignificantActivityTimePeriod > renewalThreshold * 0.95 ) {
72+ lastSignificantActivityTimePeriod = renewalThreshold * 0.95 ;
73+ }
74+
75+ if ( lastActivity > 0 && ( now - lastActivity ) > lastSignificantActivityTimePeriod ) {
6476 // don't make an attempt to renew the token if last
6577 // user activity is longer than 90 minutes ago
6678 return ;
6779 }
6880
6981 // to save some superfluous HTTP requests to the server,
7082 // try to renew only if session time is x% or more over
71- var frac = ( frontendConfig . sessionTimeout >= 1800 ) ? 0.95 : 0.8 ;
72- if ( now - self . lastTokenRenewal < frontendConfig . sessionTimeout * frac ) {
83+ if ( now - self . lastTokenRenewal < renewalThreshold ) {
7384 return ;
7485 }
7586
You can’t perform that action at this time.
0 commit comments