mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
fix(lifecycle): catch error on startup
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user