Skip to content

Conversation

jeffhwang-sq
Copy link
Collaborator

@jeffhwang-sq jeffhwang-sq commented May 15, 2025

Effective Delete-by Date Calculation
Takes the latest of:

  • Explicitly set delete_by date (if provided)
  • Default: 6 months from creation if no delete_by date
  • Based on latest run:
    • 30 days after successful completion
    • 90 days after failed run

Service Activity Check

  • Skips notifications for services that haven't registered/updated backfills in 3 months
  • Uses the last_registered_at timestamp in services table

Notification Frequency

  • No notifications before the effective delete-by date
  • After delete-by date:
    • First 3 months: Monthly reminders
    • After 3 months: Weekly reminders

Business Hours

  • Sends notifications within +/- 12hour of the backfill's creation time (in UTC)
  • Avoids weekends (UTC)

The config comes from cash-server side - https://github.com/squareup/cash-server/pull/18643

WIP - test

@jeffhwang-sq jeffhwang-sq changed the title add deprecation reminder service Introduce a deprecation reminder service May 16, 2025
@jeffhwang-sq jeffhwang-sq marked this pull request as ready for review May 16, 2025 13:25
@jeffhwang-sq jeffhwang-sq requested a review from mpawliszyn May 16, 2025 13:25
@jeffhwang-sq jeffhwang-sq force-pushed the jhwang/enable-deprecation-reminder branch from ce46279 to d7ca889 Compare May 20, 2025 15:00
@@ -0,0 +1,13 @@
CREATE TABLE deprecation_reminders (
id bigint(20) NOT NULL AUTO_INCREMENT,
registered_backfill_id bigint(20) NOT NULL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just add a last_messaged_on to registered_backfill

*/
@Singleton
class DeprecationNotificationService @Inject constructor(
private val notificationHelper: DeprecationNotificationHelper,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Two steps to sending a reminders.

  1. Figure out registered backfills should have reminders sent this hour.

  2. Determine if a reminder should go out for each backfill.

  3. look at the registered backfill

  • has a backfill run - pick the most recent run (run with the latest updated_at) look for the latest customer event and pick that time
  • no backfill run - pick registration time (approximate deploy time so this should be a good time in the day)
  • Now that you have a time and day of the week. Are we in that window?
  1. Make a call to the thing that is in cash-server whether to message now or not. Call will have a bunch of data:
  • data structure around the last backfill run
    • last user to touch the backfill
    • the last status change (Complete, Fail, Paused) & time that happened
  • Delete By date
  • Backfill creation time
    Return nothing or a message to send.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ReminderMessagingDecider

Copy link
Collaborator

Choose a reason for hiding this comment

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

Always return false. If nothing is set do this? (Although maybe we make people pick.)

Remind monthly if there is a latest backfill or after 3 months if creation only.

@jeffhwang-sq jeffhwang-sq changed the base branch from jhwang/add-last-registered-at to master May 20, 2025 18:46
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