fix(lifecycle): catch error on startup

This commit is contained in:
Nicolas Meienberger
2025-10-21 20:30:42 +02:00
parent 0090c3c43c
commit 06cb401cf7
2 changed files with 10 additions and 4 deletions

View File

@@ -8,8 +8,12 @@ import { volumeService } from "../volumes/volume.service";
import { cleanupDanglingMounts } from "./cleanup"; import { cleanupDanglingMounts } from "./cleanup";
export const startup = async () => { export const startup = async () => {
await restic.ensurePassfile(); await restic.ensurePassfile().catch((err) => {
cleanupDanglingMounts(); logger.error(`Error ensuring restic passfile exists: ${err.message}`);
});
cleanupDanglingMounts().catch((err) => {
logger.error(`Error during startup cleanup of dangling mounts: ${err.message}`);
});
const volumes = await db.query.volumesTable.findMany({ const volumes = await db.query.volumesTable.findMany({
where: or( where: or(
@@ -19,7 +23,9 @@ export const startup = async () => {
}); });
for (const volume of volumes) { for (const volume of volumes) {
await volumeService.mountVolume(volume.name); await volumeService.mountVolume(volume.name).catch((err) => {
logger.error(`Error auto-remounting volume ${volume.name} on startup: ${err.message}`);
});
} }
const existingTasks = getTasks(); const existingTasks = getTasks();

View File

@@ -1,4 +1,4 @@
import { repositoryConfigSchema } from "@ironmount/schemas"; import { repositoryConfigSchema } from "@ironmount/schemas/restic";
import { type } from "arktype"; import { type } from "arktype";
import { describeRoute, resolver } from "hono-openapi"; import { describeRoute, resolver } from "hono-openapi";