feat: cap automated reminders before resend (#3016)

Stop sending automated reminders after a configurable threshold
(default 5) and reset the count on manual resend.
This commit is contained in:
Lucas Smith
2026-06-23 15:11:52 +10:00
committed by GitHub
parent f2525ae95b
commit 04f6e76178
6 changed files with 52 additions and 17 deletions
@@ -52,6 +52,7 @@ export const run = async ({ payload, io }: { payload: TProcessSigningReminderJob
data: {
lastReminderSentAt: now,
nextReminderAt: null,
reminderCount: { increment: 1 },
},
});
@@ -243,13 +244,15 @@ export const run = async ({ payload, io }: { payload: TProcessSigningReminderJob
});
}
// Compute the next reminder time (repeat interval).
// reminderCount was incremented in the atomic claim above, so the value read
// here includes the reminder we just sent and gates the next one.
if (recipient.sentAt) {
await updateRecipientNextReminder({
recipientId: recipient.id,
envelopeId: envelope.id,
sentAt: recipient.sentAt,
lastReminderSentAt: now,
reminderCount: recipient.reminderCount,
});
}
};