##// END OF EJS Templates
frontend: do not close non-existing websocket connection - don't do anything if window is not focused
ergo -
Show More
@@ -488,13 +488,19 b' function IndexDashboardController($scope, $location, $cookies, $interval, stateH'
488 488
489 489 var intervalId = $interval(function () {
490 490 if (_.contains(['30m', "1h"], vm.timeSpan.key)) {
491 // don't do anything if window is unfocused
492 if(document.hidden === true){
493 return ;
494 }
491 495 vm.refreshData();
492 496 }
493 497 }, 60000);
494 498
495 499 $scope.$on('$destroy',function(){
496 500 $interval.cancel(intervalId);
497 vm.websocket.close();
501 if (vm.websocket && vm.websocket.readyState == 1){
502 vm.websocket.close();
503 }
498 504 });
499 505
500 506
General Comments 0
You need to be logged in to leave comments. Login now