aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-06-30 17:50:33 +0800
committerYuqian Yang <crupest@crupest.life>2025-06-30 17:50:33 +0800
commit80d6b1742a6f3ea740f4673654850fb3a1105a5c (patch)
tree1abc5f95c4ef2894d2084497bc0f6f03b5e460b6
parent7a7e4d82e5efb559048b9b6c1ca4d863b9860622 (diff)
downloadcrupest-main.tar.gz
crupest-main.tar.bz2
crupest-main.zip
mail: remove old sent mails quicker.HEADmaindev
-rw-r--r--deno/mail/dovecot.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/deno/mail/dovecot.ts b/deno/mail/dovecot.ts
index 4fe2f41..c0d56a2 100644
--- a/deno/mail/dovecot.ts
+++ b/deno/mail/dovecot.ts
@@ -17,6 +17,7 @@ async function runCommand(
logTag: string;
args: string[];
stdin?: Uint8Array;
+ suppressStartLog?: boolean;
suppressResultLog?: boolean;
errorCodeMessageMap?: Map<number, string>;
},
@@ -24,7 +25,9 @@ async function runCommand(
const { logTag, args, stdin, suppressResultLog, errorCodeMessageMap } =
options;
- console.info(logTag, `Run external command ${bin} ${args.join(" ")}`);
+ if (options.suppressResultLog !== true) {
+ console.info(logTag, `Run external command ${bin} ${args.join(" ")}`);
+ }
try {
// Create and spawn process.
@@ -129,10 +132,13 @@ export class DovecotMailDeliverer extends MailDeliverer {
user: string,
mailbox: string,
messageId: string,
+ noLog?: boolean,
): Promise<void> {
await runCommand(this.#doveadmPath, {
logTag,
args: ["expunge", "-u", user, ...this.#queryArgs(mailbox, messageId)],
+ suppressStartLog: noLog,
+ suppressResultLog: noLog,
});
}
@@ -202,11 +208,11 @@ export class DovecotMailDeliverer extends MailDeliverer {
console.info(
logTag,
- "Schedule deletion of old mails at 15,30,60 seconds later.",
+ "Schedule deletion of old mails (no logging) at 5,15,30,60 seconds later.",
);
- [15, 30, 60].forEach((seconds) =>
+ [5, 15, 30, 60].forEach((seconds) =>
setTimeout(() => {
- void this.#deleteMail(logTag, from, "Sent", messageIdToDelete);
+ void this.#deleteMail(logTag, from, "Sent", messageIdToDelete, true);
}, 1000 * seconds)
);
}