mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-29 22:58:49 +00:00
refactor: improve cleanup operation handling in postgres router
- Changed cleanup operations to use async functions for better error handling. - Replaced Promise.allSettled with a for loop to individually await each operation, allowing for more granular error management.
This commit is contained in:
@@ -282,12 +282,16 @@ export const postgresRouter = createTRPCRouter({
|
|||||||
const backups = await findBackupsByDbId(input.postgresId, "postgres");
|
const backups = await findBackupsByDbId(input.postgresId, "postgres");
|
||||||
|
|
||||||
const cleanupOperations = [
|
const cleanupOperations = [
|
||||||
removeService(postgres.appName, postgres.serverId),
|
async () => await removeService(postgres?.appName, postgres.serverId),
|
||||||
cancelJobs(backups),
|
async () => await cancelJobs(backups),
|
||||||
removePostgresById(input.postgresId),
|
async () => await removePostgresById(input.postgresId),
|
||||||
];
|
];
|
||||||
|
|
||||||
await Promise.allSettled(cleanupOperations);
|
for (const operation of cleanupOperations) {
|
||||||
|
try {
|
||||||
|
await operation();
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
|
||||||
return postgres;
|
return postgres;
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user