1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-28 01:07:58 +01:00

Rallentamento esecuzione hooks

This commit is contained in:
loviuz 2023-03-10 11:33:19 +01:00
parent 78db635ea9
commit 7c0a8ecbf7

View File

@ -56,6 +56,7 @@ function startHooks() {
* @param hook * @param hook
*/ */
function startHook(hook, init) { function startHook(hook, init) {
if (document.hasFocus()) {
$.ajax({ $.ajax({
url: globals.rootdir + "/ajax.php", url: globals.rootdir + "/ajax.php",
type: "get", type: "get",
@ -75,7 +76,7 @@ function startHook(hook, init) {
if (token) { if (token) {
executeHook(hook, token); executeHook(hook, token);
} else { } else {
var timeout = 10; var timeout = 30;
setTimeout(function () { setTimeout(function () {
startHook(hook); startHook(hook);
@ -83,6 +84,13 @@ function startHook(hook, init) {
} }
}, },
}); });
} else {
var timeout = 30;
setTimeout(function () {
startHook(hook);
}, timeout * 1000);
}
} }
/** /**
@ -108,7 +116,7 @@ function executeHook(hook, token) {
if (result.execute) { if (result.execute) {
startHook(hook); startHook(hook);
} else { } else {
timeout = 30; timeout = 60;
setTimeout(function () { setTimeout(function () {
startHook(hook); startHook(hook);