You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
695 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 手动跑数据保留清理:pnpm retention:cleanup
* dry-run: pnpm retention:cleanup -- --dry-run
*/
import { getEnv, resetEnvCache } from "../src/lib/env";
import { runDataRetentionCleanup } from "../src/services/retention/cleanup";
async function main() {
resetEnvCache();
const dryRun = process.argv.includes("--dry-run");
const env = getEnv();
console.log(
JSON.stringify(
{
DATA_RETENTION_DAYS: env.DATA_RETENTION_DAYS,
dryRun,
},
null,
2,
),
);
const stats = await runDataRetentionCleanup({ dryRun });
console.log(JSON.stringify(stats, null, 2));
}
main().catch((e) => {
console.error(e);
process.exit(1);
});