mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
* refactor: unify backend and frontend servers * refactor: correct paths for openapi & drizzle * refactor: move api-client to client * fix: drizzle paths * chore: fix linting issues * fix: form reset issue
29 lines
862 B
TypeScript
29 lines
862 B
TypeScript
import { Scheduler } from "../../core/scheduler";
|
|
import { eq, or } from "drizzle-orm";
|
|
import { db } from "../../db/db";
|
|
import { volumesTable } from "../../db/schema";
|
|
import { logger } from "../../utils/logger";
|
|
import { SOCKET_PATH } from "../../core/constants";
|
|
import { createVolumeBackend } from "../backends/backend";
|
|
|
|
export const shutdown = async () => {
|
|
await Scheduler.stop();
|
|
|
|
await Bun.file(SOCKET_PATH)
|
|
.delete()
|
|
.catch(() => {
|
|
// Ignore errors if the socket file does not exist
|
|
});
|
|
|
|
const volumes = await db.query.volumesTable.findMany({
|
|
where: or(eq(volumesTable.status, "mounted")),
|
|
});
|
|
|
|
for (const volume of volumes) {
|
|
const backend = createVolumeBackend(volume);
|
|
const { status, error } = await backend.unmount();
|
|
|
|
logger.info(`Volume ${volume.name} unmount status: ${status}${error ? `, error: ${error}` : ""}`);
|
|
}
|
|
};
|