From e1b6f174f9d3ca797521b2a7a60dccdd52a6c5ea Mon Sep 17 00:00:00 2001 From: Dean Whillier Date: Mon, 25 Feb 2019 16:23:28 -0500 Subject: [PATCH] immediately return when connection is offline (#2594) --- app/utils/network.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/utils/network.js b/app/utils/network.js index 4a6cac21f..78c02fedb 100644 --- a/app/utils/network.js +++ b/app/utils/network.js @@ -10,13 +10,11 @@ import {Client4} from 'mattermost-redux/client'; import mattermostBucket from 'app/mattermost_bucket'; import LocalConfig from 'assets/config'; -const PING_TIMEOUT = 3000; - let certificate = ''; let previousState; export async function checkConnection(isConnected) { - if (!Client4.getBaseRoute().startsWith('http')) { - // If we don't have a server yet, return the default implementation + if (!isConnected || !Client4.getBaseRoute().startsWith('http')) { + // If we don't have a connection or have a server yet, return the default implementation return {hasInternet: isConnected, serverReachable: false}; } @@ -24,7 +22,6 @@ export async function checkConnection(isConnected) { const server = `${Client4.getBaseRoute()}/system/ping?time=${Date.now()}`; const config = { - timeout: PING_TIMEOUT, auto: true, waitsForConnectivity: true, };