mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-04-18 05:47:31 -04:00
* refactor: move migrations to new structure * refactor: convert all findMany to new structure * fix(backups-schedule): missing null matching for last backup status * chore: move root lib to server
20 lines
588 B
TypeScript
20 lines
588 B
TypeScript
import { Scheduler } from "../../core/scheduler";
|
|
import { db } from "../../db/db";
|
|
import { logger } from "../../utils/logger";
|
|
import { createVolumeBackend } from "../backends/backend";
|
|
|
|
export const shutdown = async () => {
|
|
await Scheduler.stop();
|
|
|
|
const volumes = await db.query.volumesTable.findMany({
|
|
where: { 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}` : ""}`);
|
|
}
|
|
};
|