chore: Update the types for container runtime

This commit is contained in:
J H
2024-03-28 10:51:51 -06:00
parent 65ca038eee
commit 8ce6535a7e

View File

@@ -113,25 +113,24 @@ export class MainLoop {
if (executed.exitCode === 59) { if (executed.exitCode === 59) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "disabled", id: healthId,
message: result: "disabled",
executed.stderr.toString() || executed.stdout.toString(),
}) })
return return
} }
if (executed.exitCode === 60) { if (executed.exitCode === 60) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "starting", id: healthId,
message: result: "starting",
executed.stderr.toString() || executed.stdout.toString(),
}) })
return return
} }
if (executed.exitCode === 61) { if (executed.exitCode === 61) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "warning", id: healthId,
result: "failure",
message: message:
executed.stderr.toString() || executed.stdout.toString(), executed.stderr.toString() || executed.stdout.toString(),
}) })
@@ -142,14 +141,16 @@ export class MainLoop {
if (!!errorMessage) { if (!!errorMessage) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "failure", id: healthId,
message: errorMessage, result: "failure",
message: errorMessage || "",
}) })
return return
} }
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "passing", id: healthId,
result: "success",
message, message,
}) })
return return
@@ -160,7 +161,8 @@ export class MainLoop {
if (!method) { if (!method) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "failure", id: healthId,
result: "failure",
message: `Expecting that thejs health check ${healthId} exists`, message: `Expecting that thejs health check ${healthId} exists`,
}) })
return return
@@ -173,16 +175,18 @@ export class MainLoop {
if ("result" in result) { if ("result" in result) {
await effects.setHealth({ await effects.setHealth({
message: null, message: "",
name: healthId, name: healthId,
status: "passing", id: healthId,
result: "success",
}) })
return return
} }
if ("error" in result) { if ("error" in result) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "failure", id: healthId,
result: "failure",
message: result.error, message: result.error,
}) })
return return
@@ -190,7 +194,8 @@ export class MainLoop {
if (!("error-code" in result)) { if (!("error-code" in result)) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "failure", id: healthId,
result: "failure",
message: `Unknown error type ${JSON.stringify(result)}`, message: `Unknown error type ${JSON.stringify(result)}`,
}) })
return return
@@ -199,23 +204,24 @@ export class MainLoop {
if (code === 59) { if (code === 59) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "disabled", id: healthId,
message, result: "disabled",
}) })
return return
} }
if (code === 60) { if (code === 60) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "starting", id: healthId,
message, result: "starting",
}) })
return return
} }
if (code === 61) { if (code === 61) {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "warning", id: healthId,
result: "failure",
message, message,
}) })
return return
@@ -223,7 +229,8 @@ export class MainLoop {
await effects.setHealth({ await effects.setHealth({
name: healthId, name: healthId,
status: "failure", id: healthId,
result: "failure",
message: `${result["error-code"][0]}: ${result["error-code"][1]}`, message: `${result["error-code"][0]}: ${result["error-code"][1]}`,
}) })
return return