From e5e74130ebbf5ef47488682d3e22d09b036bf26a Mon Sep 17 00:00:00 2001 From: Juan Fuentes <juanf@bs-mbpr28.d.ethz.ch> Date: Wed, 4 Sep 2019 13:18:28 +0200 Subject: [PATCH] SSDM-8698 : Keep session alive --- .../html/js/controllers/MainController.js | 3 +++ .../eln-lims/html/js/server/ServerFacade.js | 24 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js index a4c8633e158..8c6bfbcf1f2 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js @@ -197,6 +197,9 @@ function MainController(profile) { Util.unblockUI(); LayoutManager.resize(mainController.views, true); // Maybe fixes white screen on startup? + + // Keep Alive + localReference.serverFacade.scheduleKeepAlive(); }); }; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index 96e277604e4..60957f284c6 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -184,7 +184,29 @@ function ServerFacade(openbisServer) { }); } */ - + + this.scheduleKeepAlive = function() { + var _this = this; + var TIMEOUT = 30000; //30 Seconds + + setTimeout(function(){ + _this.keepAlive(); + }, TIMEOUT); + } + + this.keepAlive = function() { + var _this = this; + mainController.openbisV3.isSessionActive().done(function(isSessionActive) { + var timeStamp = Math.floor(Date.now() / 1000); + console.log("done - " + timeStamp + " - " + isSessionActive); + _this.scheduleKeepAlive(); + }).fail(function(error) { + var timeStamp = Math.floor(Date.now() / 1000); + console.log("fail - " + timeStamp + " - ERROR"); + _this.scheduleKeepAlive(); + }); + } + this.getPersons = function(personIds, callbackFunction) { if(!mainController.openbisV3.getPersons) { return null; // In case the method doesn't exist, do nothing -- GitLab