Queue server creation and verify health and selected map before completion
This commit is contained in:
@@ -277,7 +277,7 @@ const STATE_KEYS = new Set([
|
||||
'docker_status'
|
||||
]);
|
||||
|
||||
function extractContainerState(payload: unknown): string | null {
|
||||
export function extractContainerState(payload: unknown): string | null {
|
||||
const seen = new Set<unknown>();
|
||||
let found: string | null = null;
|
||||
|
||||
@@ -297,6 +297,12 @@ function extractContainerState(payload: unknown): string | null {
|
||||
const status = so['Status'];
|
||||
const running = so['Running'];
|
||||
const health = so['Health'];
|
||||
// A running process can still be starting or unhealthy. Honor an
|
||||
// explicit Docker health check before accepting its running state.
|
||||
if ((running === true || status === 'running') && health && typeof health === 'object') {
|
||||
const hs = (health as Record<string, unknown>)['Status'];
|
||||
if (typeof hs === 'string' && hs.toLowerCase() !== 'healthy') { found = hs; return; }
|
||||
}
|
||||
if (typeof status === 'string') { found = status; return; }
|
||||
if (running === true) { found = 'running'; return; }
|
||||
if (health && typeof health === 'object') {
|
||||
|
||||
Reference in New Issue
Block a user