From a16fbd3eaa165b3226a3b0ed9848b51718aaeafa Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Mon, 2 Jun 2025 18:55:32 -0700 Subject: Fixes when the map of an either is expected to be possible undefined --- server/health.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'server/health.ts') diff --git a/server/health.ts b/server/health.ts index 1acc074..8fbc69d 100644 --- a/server/health.ts +++ b/server/health.ts @@ -17,12 +17,9 @@ export const healthCheck: HealthChecker = ( .bimap(TraceUtil.withFunctionTrace(healthCheck)) .move(getRequiredEnv("LAMINAR_HOST")) // ensure LAMINAR_HOST is propagated to getStdout for other procedures - .map((e) => e.get().moveRight(["laminarc", "show-jobs"])) - .map((i) => - i - .get() - .mapRight(i.move.apply) - .flatMapAsync(getStdout.apply) - .then((gotJobs) => gotJobs.moveRight(HealthCheckOutput.YAASSSLAYQUEEN)), - ) + .map((tEitherEnv) => tEitherEnv.get() + .flatMapAsync((_hasEnv) => + getStdout(tEitherEnv.move(["laminarc", "show-jobs"])) + )) + .map(TraceUtil.promiseify((stdout) => stdout.get().moveRight(HealthCheckOutput.YAASSSLAYQUEEN))) .get(); -- cgit v1.2.3-70-g09d2