File tree 1 file changed +14
-3
lines changed
js/apps/system/_admin/aardvark/APP/frontend/js/views 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 56
56
// only try to renew token if we are still online
57
57
return ;
58
58
}
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 ;
59
63
60
64
var now = Date . now ( ) / 1000 ;
61
65
var lastActivity = arangoHelper . lastActivity ( ) ;
62
66
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 ) {
64
76
// don't make an attempt to renew the token if last
65
77
// user activity is longer than 90 minutes ago
66
78
return ;
67
79
}
68
80
69
81
// to save some superfluous HTTP requests to the server,
70
82
// 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 ) {
73
84
return ;
74
85
}
75
86
You can’t perform that action at this time.
0 commit comments