Skip to content

Comprehensive workflow reminder management for booking lifecycle events#6

Open
akshayutture-augment wants to merge 1 commit into
workflow-queue-basefrom
workflow-queue-enhanced
Open

Comprehensive workflow reminder management for booking lifecycle events#6
akshayutture-augment wants to merge 1 commit into
workflow-queue-basefrom
workflow-queue-enhanced

Conversation

@akshayutture-augment

Copy link
Copy Markdown

…re still sent (#7232)

* small UI fix

* fix cancelling scheduled emails

* improve comments

* delete reminders for rescheduled bookings

* add migration file

* cancel rescheduled bookings immediately

* remove immediate delete for request reschedule

---------

Co-authored-by: CarinaWolli <wollencarina@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +200 to 232
immediateDelete?: boolean
) => {
try {
await client.request({
url: "/v3/user/scheduled_sends",
method: "POST",
body: {
batch_id: referenceId,
status: "cancel",
},
});
if (!referenceId) {
await prisma.workflowReminder.delete({
where: {
id: reminderId,
},
});

return;
}

await client.request({
url: `/v3/user/scheduled_sends/${referenceId}`,
method: "DELETE",
if (immediateDelete) {
await client.request({
url: "/v3/user/scheduled_sends",
method: "POST",
body: {
batch_id: referenceId,
status: "cancel",
},
});
return;
}

await prisma.workflowReminder.update({
where: {
id: reminderId,
},
data: {
cancelled: true,
},
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Cancelled bookings still send workflow reminders

With the new implementation of deleteScheduledEmailReminder (packages/features/ee/workflows/lib/reminders/emailReminderManager.ts lines 200‑232) we no longer cancel the SendGrid batch unless immediateDelete is explicitly set. The default path merely toggles a cancelled flag in the database. Booking cancellation flows such as packages/features/bookings/lib/handleCancelBooking.ts (lines 484‑489) call this helper without the immediateDelete flag, so after a host cancels an event the reminder remains scheduled at SendGrid until the cron job processes it. The cron in packages/features/ee/workflows/api/scheduleEmailReminders.ts first deletes any reminders whose scheduledDate <= now (lines 33‑41) before it attempts to cancel the ones flagged as cancelled (lines 43‑74). This means that if a booking is cancelled within the final hour before a reminder fires (the exact window the cron considers), the row is deleted before SendGrid is contacted, so the reminder email is still delivered for a cancelled booking. We need to keep cancelling the SendGrid batch immediately (or at least before removing the reminder record) for the non‑immediateDelete path to prevent reminders from being sent after a cancellation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants