diff --git a/lib/agent/control-panel/websockets/index.js b/lib/agent/control-panel/websockets/index.js index 7c3a829eb..033915321 100644 --- a/lib/agent/control-panel/websockets/index.js +++ b/lib/agent/control-panel/websockets/index.js @@ -40,6 +40,7 @@ let websocketConnected = false; let workingWithProxy = true; let countNotConnectionProxy = 0; let pongReceived = false; +let timerSendLocation; const startupTimeout = 5000; const heartbeatTimeout = 120000 + 1000; @@ -346,6 +347,12 @@ exports.startWebsocket = () => { }); } }); + if (timerSendLocation) clearTimeout(timerSendLocation); + timerSendLocation = setTimeout(() => { + hooks.trigger('get_location', 'interval'); + logger.info('Sending location interval'); + }, 1000 * 10); + }); ws.on('close', (code) => { @@ -356,6 +363,7 @@ exports.startWebsocket = () => { } restartWebsocketCall(); } + if (timerSendLocation) clearTimeout(timerSendLocation); }); ws.on('message', (data) => {