Skip to content

Commit 4fb2469

Browse files
committed
fix for issue when going to new version(where session timeout is stored in seconds not miliseconds)
1 parent 598871b commit 4fb2469

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

frontend/express/public/javascripts/countly/countly.template.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -1198,10 +1198,14 @@ var AppRouter = Backbone.Router.extend({
11981198
}
11991199
else if (result == "success") {
12001200
shouldRecordAction = false;
1201+
var myTimeoutValue = parseInt(countlyGlobal.config["session_timeout"])*1000*60;
1202+
if(myTimeoutValue>2147483647) {//max value used by set timeout function
1203+
myTimeoutValue = 1800000;//30 minutes
1204+
}
12011205
setTimeout(function () {
12021206
shouldRecordAction = true;
1203-
}, Math.round(parseInt(countlyGlobal.config["session_timeout"]) / 2)*1000*60);
1204-
resetSessionTimeouts(parseInt(countlyGlobal.config["session_timeout"])*1000*60);
1207+
}, Math.round(myTimeoutValue/2));
1208+
resetSessionTimeouts(myTimeoutValue);
12051209
}
12061210
}
12071211
});
@@ -1236,8 +1240,11 @@ var AppRouter = Backbone.Router.extend({
12361240
extendSession();
12371241
}, timeout + 1000);
12381242
};
1239-
1240-
resetSessionTimeouts(parseInt(countlyGlobal.config["session_timeout"])*1000*60);
1243+
1244+
var myTimeoutValue = parseInt(countlyGlobal.config["session_timeout"])*1000*60;
1245+
if(myTimeoutValue>2147483647) //max value used by set timeout function
1246+
myTimeoutValue = 1800000;//30 minutes
1247+
resetSessionTimeouts(myTimeoutValue);
12411248
$(document).on("click mousemove extend-dashboard-user-session", function (event) {
12421249
if (shouldRecordAction)
12431250
extendSession();

0 commit comments

Comments
 (0)