SMS workflow reminder retry count tracking#3
Conversation
* add retry count to workflow reminder * add logic to for retry count --------- Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| //delete all scheduled sms reminders where scheduled date is past current date | ||
| await prisma.workflowReminder.deleteMany({ | ||
| where: { | ||
| method: WorkflowMethods.SMS, | ||
| scheduledDate: { | ||
| lte: dayjs().toISOString(), | ||
| }, | ||
| OR: [ | ||
| { | ||
| method: WorkflowMethods.SMS, | ||
| scheduledDate: { | ||
| lte: dayjs().toISOString(), | ||
| }, | ||
| }, | ||
| { | ||
| retryCount: { | ||
| gt: 1, | ||
| }, | ||
| }, | ||
| ], | ||
| }, |
There was a problem hiding this comment.
Stop deleting reminders after two retries
The cleanup query now deletes any WorkflowReminder whose retryCount is greater than 1 (lines 28‑44). Because the new logic increments retryCount every time scheduling fails or throws (lines 179‑196), a reminder that experiences two transient Twilio errors will be removed the next time the cron runs instead of being retried again. Before this change those reminders kept being retried until Twilio accepted the schedule; now they silently disappear and the attendee never receives the SMS. If the intent was only to track retries, the retryCount check needs to be removed or replaced with explicit cancellation logic instead of unconditional deletion.
Useful? React with 👍 / 👎.
Test 9
Replicated from ai-code-review-evaluation/cal.com-cursor#9