mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
refactor(backup): rename async function for clarity and improve error logging
- Changed the anonymous async function to a named function `runRestore` for better readability. - Enhanced error handling to log specific error messages during the restore process.
This commit is contained in:
@@ -547,7 +547,7 @@ export const backupRouter = createTRPCRouter({
|
||||
const queue: string[] = [];
|
||||
let done = false;
|
||||
const onLog = (log: string) => queue.push(log);
|
||||
(async () => {
|
||||
const runRestore = async () => {
|
||||
if (input.backupType === "database") {
|
||||
if (input.databaseType === "postgres") {
|
||||
const postgres = await findPostgresById(input.databaseId);
|
||||
@@ -571,8 +571,13 @@ export const backupRouter = createTRPCRouter({
|
||||
const compose = await findComposeById(input.databaseId);
|
||||
await restoreComposeBackup(compose, destination, input, onLog);
|
||||
}
|
||||
})()
|
||||
.catch(() => {})
|
||||
};
|
||||
runRestore()
|
||||
.catch((error) => {
|
||||
onLog(
|
||||
`Error: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
})
|
||||
.finally(() => {
|
||||
done = true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user