File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -81,14 +81,20 @@ function getLocalStackStatus(
8181 }
8282}
8383
84- async function fetchHealth ( ) : Promise < boolean > {
85- // health is ok in the majority of use cases, however, determining status based on it can be flaky.
86- // for example, if localstack becomes unhealthy while running for reasons other that stop then reporting "stopping" may be misleading.
87- // though we don't know if it happens often.
84+ async function fetchHealth ( outputChannel : LogOutputChannel ) : Promise < boolean > {
85+ // Abort the fetch if it takes more than 500ms.
86+ const controller = new AbortController ( ) ;
87+ setTimeout ( ( ) => controller . abort ( ) , 500 ) ;
88+
8889 try {
89- const response = await fetch ( "http://localhost:4566/_localstack/health" ) ;
90+ // health is ok in the majority of use cases, however, determining status based on it can be flaky.
91+ // for example, if localstack becomes unhealthy while running for reasons other that stop then reporting "stopping" may be misleading.
92+ // though we don't know if it happens often.
93+ const response = await fetch ( "http://localhost:4566/_localstack/health" , {
94+ signal : controller . signal ,
95+ } ) ;
9096 return response . ok ;
91- } catch {
97+ } catch ( err ) {
9298 return false ;
9399 }
94100}
You can’t perform that action at this time.
0 commit comments