chore: Annotate delayed notifs (#10447)

This commit is contained in:
Tom Moor authored and GitHub committed 2025-10-22 17:48:12 -04:00
1 parent fc6152bd55
commit a5d065e5ec
1 file changed
+11 -1
+11 -1
View File
@@ -1,6 +1,7 @@
import addressparser, { EmailAddress } from "addressparser";
import Bull from "bull";
import invariant from "invariant";
import { subMinutes } from "date-fns";
import { Node } from "prosemirror-model";
import { randomString } from "@shared/random";
import { TeamPreference } from "@shared/types";
@@ -143,12 +144,21 @@ export default abstract class BaseEmail<
? await Notification.emailReferences(notification)
: undefined;
// Check if notification is considerably delayed and annotate
// the subject. This is incase of extended downtime or queue backlogs
let subject = this.subject(data);
if (notification) {
if (notification.createdAt < subMinutes(new Date(), 30)) {
subject = `Delayed notification: ${subject}`;
}
}
try {
await mailer.sendMail({
to: this.props.to,
replyTo: this.replyTo?.(data),
from: this.from(data),
subject: this.subject(data),
subject,
messageId,
references,
previewText: this.preview(data),