Skip to content

Commit eb8c6e4

Browse files
authored
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
2 parents e316bea + 965f05c commit eb8c6e4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

apps/dokploy/server/api/routers/postgres.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,16 @@ export const postgresRouter = createTRPCRouter({
282282
const backups = await findBackupsByDbId(input.postgresId, "postgres");
283283

284284
const cleanupOperations = [
285-
removeService(postgres.appName, postgres.serverId),
286-
cancelJobs(backups),
287-
removePostgresById(input.postgresId),
285+
async () => await removeService(postgres?.appName, postgres.serverId),
286+
async () => await cancelJobs(backups),
287+
async () => await removePostgresById(input.postgresId),
288288
];
289289

290-
await Promise.allSettled(cleanupOperations);
290+
for (const operation of cleanupOperations) {
291+
try {
292+
await operation();
293+
} catch (_) {}
294+
}
291295

292296
return postgres;
293297
}),

0 commit comments

Comments
 (0)