Skip to content

about #715 #716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: integ
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions module/htdocs/js/shinken-refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if (sessionStorage.getItem("refresh_enabled") == '1') {
* ---------------------------------------------------------------------------
*/
var processing_refresh = false;
var nb_refresh = 0;
function do_refresh(forced){
if (processing_refresh) {
if (refresh_logs) console.debug("Avoid simultaneous refreshes ...");
Expand All @@ -73,6 +74,15 @@ function do_refresh(forced){
$('#header_loading').addClass('fa-spin');
processing_refresh = true;

// Because of mem leak, we avoid to do to much soft refreshes and sometimes we force a full reload
if (nb_refresh > 10){
if (document.visibilityState == 'hidden'){
if (refresh_logs) console.debug("Reloading page: ", document.URL);
location.reload();
}
}
nb_refresh += 1;

$.ajax({
url: document.URL,
method: "get",
Expand Down
20 changes: 13 additions & 7 deletions module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,20 @@
# Alignak / Shinken base module are slightly different
if ALIGNAK:
from alignak.basemodule import BaseModule
from alignak.modulesmanager import ModulesManager
from alignak.daemon import Daemon
from alignak.external_command import ExternalCommandManager
else:
from shinken.basemodule import BaseModule
from shinken.modulesmanager import ModulesManager
from shinken.daemon import Daemon

# Regenerate objects from the received broks
from regenerator import Regenerator

from shinken.modulesctx import modulesctx
from shinken.modulesmanager import ModulesManager
from shinken.daemon import Daemon


from shinken.util import to_bool

# Bottle import
Expand Down Expand Up @@ -489,12 +494,12 @@ def main(self): # pylint: disable=global-statement
else:
self.debug_output = []

for m in self.modules:
m.enabled = True

logger.info("[WebUI] configured modules %s", [m.get_name() for m in self.modules])
self.modules_manager = ModulesManager('webui', self.find_modules_path(), [])
self.modules_manager.set_modules(self.modules)
# This function is loading all the installed 'webui' daemon modules...
self.do_load_modules()
logger.info("[WebUI] imported %d modules", len(self.modules_manager.imported_modules))
self.modules_manager = ModulesManager(self)
self.modules_manager.load_and_init(self.modules)

for inst in self.modules_manager.instances:
logger.info("[WebUI] loading %s", inst.get_name())
Expand Down Expand Up @@ -733,6 +738,7 @@ def manage_brok_thread(self):
continue

# try to relaunch dead module
self.max_queue_size = 42000 #FIXME to make check_and_del_zombie_modules to finish (Daemon.__init__ is not called)
self.check_and_del_zombie_modules()

if not message:
Expand Down