fix: remove cleanup address due to many table need to be clean (#240)

This commit is contained in:
Dream Hunter
2024-05-16 13:11:29 +08:00
committed by GitHub
parent 78badf2eaa
commit bbc4c05d69
4 changed files with 0 additions and 32 deletions

View File

@@ -68,12 +68,6 @@ export const cleanup = async (c, cleanType, cleanDays) => {
(select name from address) AND created_at < datetime('now', '-${cleanDays} day')`
).run();
break;
case "address":
await c.env.DB.prepare(`
DELETE FROM address WHERE updated_at < datetime('now', '-${cleanDays} day')`
+ ` AND id NOT IN (SELECT address_id FROM users_address)`
).run();
break;
case "sendbox":
await c.env.DB.prepare(`
DELETE FROM sendbox WHERE created_at < datetime('now', '-${cleanDays} day')`

View File

@@ -29,7 +29,6 @@ export class CleanupSettings {
const {
enableMailsAutoCleanup, cleanMailsDays,
enableUnknowMailsAutoCleanup, cleanUnknowMailsDays,
enableAddressAutoCleanup, cleanAddressDays,
enableSendBoxAutoCleanup, cleanSendBoxDays
} = data || {};
/** @type {boolean|undefined} */
@@ -41,10 +40,6 @@ export class CleanupSettings {
/** @type {number|undefined} */
this.cleanUnknowMailsDays = cleanUnknowMailsDays;
/** @type {boolean|undefined} */
this.enableAddressAutoCleanup = enableAddressAutoCleanup;
/** @type {number|undefined} */
this.cleanAddressDays = cleanAddressDays;
/** @type {boolean|undefined} */
this.enableSendBoxAutoCleanup = enableSendBoxAutoCleanup;
/** @type {number|undefined} */
this.cleanSendBoxDays = cleanSendBoxDays;

View File

@@ -25,13 +25,6 @@ export async function scheduled(event, env, ctx) {
autoCleanupSetting.cleanUnknowMailsDays
);
}
if (autoCleanupSetting.enableAddressAutoCleanup && autoCleanupSetting.cleanAddressDays > 0) {
await cleanup(
{ env: env, },
"address",
autoCleanupSetting.cleanAddressDays
);
}
if (autoCleanupSetting.enableSendBoxAutoCleanup && autoCleanupSetting.cleanSendBoxDays > 0) {
await cleanup(
{ env: env, },