mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-19 14:15:21 +02:00
Merge pull request #3105 from Dokploy/Failed-to-schedule-a-backup-for-a-non-existent-(deleted)-database
refactor: improve cleanup operation handling in postgres router
This commit is contained in:
@@ -282,12 +282,16 @@ export const postgresRouter = createTRPCRouter({
|
||||
const backups = await findBackupsByDbId(input.postgresId, "postgres");
|
||||
|
||||
const cleanupOperations = [
|
||||
removeService(postgres.appName, postgres.serverId),
|
||||
cancelJobs(backups),
|
||||
removePostgresById(input.postgresId),
|
||||
async () => await removeService(postgres?.appName, postgres.serverId),
|
||||
async () => await cancelJobs(backups),
|
||||
async () => await removePostgresById(input.postgresId),
|
||||
];
|
||||
|
||||
await Promise.allSettled(cleanupOperations);
|
||||
for (const operation of cleanupOperations) {
|
||||
try {
|
||||
await operation();
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
return postgres;
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user