This commit is contained in:
2026-06-21 03:53:06 +03:00
commit f1dd557c5d
147 changed files with 34363 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { postgres } from "./utils/postgres.ts";
cleanupPostgres();
setInterval(cleanupPostgres, 5 * 60 * 1000);
async function cleanupPostgres() {
if (!postgres) {
return;
}
console.time("[CLEANUP]");
const result = await postgres?.query(
`DELETE FROM room WHERE owner IS NULL AND ("lastUpdateTime" < NOW() - INTERVAL '1 day' OR "lastUpdateTime" IS NULL)`,
);
console.log(result.command, result.rowCount);
console.timeEnd("[CLEANUP]");
}