Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/utils/localstack-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,19 @@ function getLocalStackStatus(
}

async function fetchHealth(): Promise<boolean> {
// health is ok in the majority of use cases, however, determining status based on it can be flaky.
// for example, if localstack becomes unhealthy while running for reasons other that stop then reporting "stopping" may be misleading.
// though we don't know if it happens often.
// Abort the fetch if it takes more than 500ms.
const controller = new AbortController();
setTimeout(() => controller.abort(), 500);

try {
const response = await fetch("http://localhost:4566/_localstack/health");
// health is ok in the majority of use cases, however, determining status based on it can be flaky.
// for example, if localstack becomes unhealthy while running for reasons other that stop then reporting "stopping" may be misleading.
// though we don't know if it happens often.
const response = await fetch("http://localhost:4566/_localstack/health", {
signal: controller.signal,
});
return response.ok;
} catch {
} catch (err) {
return false;
}
}
Loading