From 6d501c84c59e900e7ea56dec28c986bb63f59cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 15 May 2020 14:10:42 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20Cancel=20socket=20connect=20timeout?= =?UTF-8?q?=20before=20viewmodel=20trigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Possible solution for #3502 --- src/octoprint/static/js/app/dataupdater.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/octoprint/static/js/app/dataupdater.js b/src/octoprint/static/js/app/dataupdater.js index 7e88e68bf..c2221ba8e 100644 --- a/src/octoprint/static/js/app/dataupdater.js +++ b/src/octoprint/static/js/app/dataupdater.js @@ -157,6 +157,14 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) { var oldConfigHash = self._configHash; self._configHash = data["config_hash"]; + log.info("Connected to the server"); + + // if we have a connected promise, resolve it now + if (self._connectedDeferred) { + self._connectedDeferred.resolve(); + self._connectedDeferred = undefined; + } + self._ifInitialized(function() { // process safe mode if (self._safeModePopup) self._safeModePopup.remove(); @@ -192,9 +200,11 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) { // hide it, plus reload the camera feed if it's currently displayed if ($("#offline_overlay").is(":visible")) { hideOfflineOverlay(); + log.info("Triggering reconnect on all view models"); callViewModels(self.allViewModels, "onServerReconnect"); callViewModels(self.allViewModels, "onDataUpdaterReconnect"); } else { + log.info("Triggering connect on all view models"); callViewModels(self.allViewModels, "onServerConnect"); } @@ -207,15 +217,8 @@ function DataUpdater(allViewModels, connectCallback, disconnectCallback) { showReloadOverlay(); } + log.info("Server (re)connect processed"); }); - - log.info("Connected to the server"); - - // if we have a connected promise, resolve it now - if (self._connectedDeferred) { - self._connectedDeferred.resolve(); - self._connectedDeferred = undefined; - } }; self._onHistoryData = function(event) {