Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Better performance for cleanup images

Andras Bacsaif5714536967d
diff --git a/src/lib/queues/cleanup.ts b/src/lib/queues/cleanup.ts
index 05f795799e..d5dc493817 100644
--- a/src/lib/queues/cleanup.ts
+++ b/src/lib/queues/cleanup.ts
@@ -2,8 +2,9 @@ import { asyncExecShell, getEngine, version } from '$lib/common';
import { prisma } from '$lib/database';
export default async function (): Promise<void> {
const destinationDockers = await prisma.destinationDocker.findMany();
- for (const destinationDocker of destinationDockers) {
- const host = getEngine(destinationDocker.engine);
+ const engines = [...new Set(destinationDockers.map(({ engine }) => engine))];
+ for (const engine of engines) {
+ const host = getEngine(engine);
// Cleanup old coolify images
try {
let { stdout: images } = await asyncExecShell(
@@ -28,7 +29,7 @@ export default async function (): Promise<void> {
}
// Cleanup old images older than a day
try {
- await asyncExecShell(`DOCKER_HOST=${host} docker image prune --filter "until=24h" -a -f`);
+ await asyncExecShell(`DOCKER_HOST=${host} docker image prune --filter "until=72h" -a -f`);
} catch (error) {
//console.log(error);
}