diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-06-30 17:50:33 +0800 | 
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-06-30 17:50:33 +0800 | 
| commit | 5e250ddcdbd6307989071e4ea794b1ad39e928e5 (patch) | |
| tree | 0933d7f927f1f8de7b07b18328abb7c6dc6e2f84 /deno | |
| parent | 7343425235274fda91fc948c3a4ab3c9259bf0b7 (diff) | |
| download | crupest-5e250ddcdbd6307989071e4ea794b1ad39e928e5.tar.gz crupest-5e250ddcdbd6307989071e4ea794b1ad39e928e5.tar.bz2 crupest-5e250ddcdbd6307989071e4ea794b1ad39e928e5.zip | |
mail: remove old sent mails quicker.
Diffstat (limited to 'deno')
| -rw-r--r-- | deno/mail/dovecot.ts | 14 | 
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)      );    } | 
