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