mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-05-18 19:17:36 +08:00
fix: remove cleanup address due to many table need to be clean (#240)
This commit is contained in:
@@ -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')`
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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, },
|
||||
|
||||
Reference in New Issue
Block a user