From f1f13e6248148faa41c451f10bb81f80016f3357 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 30 Nov 2013 13:47:42 -0800 Subject: [PATCH] Add delay before showing backend connection lost --- src/UI/Shared/SignalRBroadcaster.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/UI/Shared/SignalRBroadcaster.js b/src/UI/Shared/SignalRBroadcaster.js index a91e08a5c..296f81457 100644 --- a/src/UI/Shared/SignalRBroadcaster.js +++ b/src/UI/Shared/SignalRBroadcaster.js @@ -29,6 +29,7 @@ define( var tryingToReconnect = false; var messengerId = 'signalR'; + var reconnectTimeout; this.signalRconnection = $.connection('/signalr'); @@ -47,15 +48,18 @@ define( tryingToReconnect = true; - Messenger.show({ - id : messengerId, - type : 'info', - hideAfter : 0, - message : 'Connection to backend lost, attempting to reconnect' - }); + reconnectTimeout = window.setTimeout(function () { + Messenger.show({ + id : messengerId, + type : 'info', + hideAfter : 0, + message : 'Connection to backend lost, attempting to reconnect' + }); + }, 10000); }); this.signalRconnection.reconnected(function() { + window.clearTimeout(reconnectTimeout); tryingToReconnect = false; var currentVersion = StatusModel.get('version');