@@ -18,6 +18,7 @@ import {
1818} from './types' ;
1919import { logger } from './utils/logger' ;
2020import { EndPoints } from './utils/authService' ;
21+ import { isActiveService } from './utils/authService/tokenizedAuthService' ;
2122
2223/**
2324 * Construct a runtime filters query string from the given filters.
@@ -526,26 +527,16 @@ export const checkInternetConnection = async (
526527
527528 for ( let attempt = 0 ; attempt <= maxRetries ; attempt ++ ) {
528529 try {
529- const controller = new AbortController ( ) ;
530- const timeoutId = setTimeout ( ( ) => controller . abort ( ) , 5000 ) ;
531-
532- const response = await fetch ( pingUrl , {
533- method : 'HEAD' ,
534- cache : 'no-store' ,
535- signal : controller . signal ,
536- } ) ;
537-
538- clearTimeout ( timeoutId ) ;
539-
540- if ( response . status >= 200 && response . status < 300 ) {
530+ const response = await isActiveService ( thoughtSpotHost ) ;
531+ logger . debug ( `Pinging ${ pingUrl } failed with response ${ response } ` ) ;
532+ if ( response ) {
541533 if ( attempt > 0 ) {
542534 logger . info ( 'Internet connection restored' ) ;
543535 }
544536 return true ;
545537 }
546-
547- logger . debug ( `Pinging ${ pingUrl } failed with HTTP ${ response . status } : ${ response . statusText } ` ) ;
548- throw new Error ( `Server responded with status ${ response . status } . Error: ${ response . statusText } ` ) ;
538+ logger . debug ( `Pinging ${ pingUrl } failed with response ${ response } ` ) ;
539+ throw new Error ( `Server responded with status ${ response } .` ) ;
549540 } catch ( error ) {
550541 const isLastAttempt = attempt === maxRetries ;
551542 const delayMs = baseDelay * Math . pow ( 2 , attempt ) ;
0 commit comments