refactor: cleanup startup code and add cron job

This commit is contained in:
Nicolas Meienberger
2025-09-23 23:01:42 +02:00
parent 5695a8c700
commit db88bb6de2
5 changed files with 64 additions and 95 deletions

View File

@@ -8,6 +8,7 @@ import { logger } from "../../../utils/logger";
import { promisify } from "node:util";
import { withTimeout } from "../../../utils/timeout";
import { OPERATION_TIMEOUT } from "../../../core/constants";
import { toMessage } from "../../../utils/errors";
const execFile = promisify(execFileCb);
@@ -121,8 +122,8 @@ const checkHealth = async (path: string) => {
try {
return await withTimeout(run(), OPERATION_TIMEOUT, "NFS health check");
} catch (error) {
logger.error("NFS volume health check failed:", error);
return { status: BACKEND_STATUS.error, error: error instanceof Error ? error.message : String(error) };
logger.error("NFS volume health check failed:", toMessage(error));
return { status: BACKEND_STATUS.error, error: toMessage(error) };
}
};