Ask A Question


You’re not receiving notifications from this thread.

Scheduled Notifications (recurring email at time of choice, in time zone)

Arnaud asked in Rails

I'm wondering about the best way to approach scheduled notifications.

Having users who set their timezone and pick the best time to receive a regular notification (can be daily or less often), I came up with 2 options.

Option A: Individual schedules
Use resque-scheduler with dynamic schedules, one per user.
Each schedule has its own frequency and will call SendDigestJob, which itself tells the Mailer to prepare the mail and deliver it now

Option B: Batch deliver_later
Run a task every hour, fetch the users who should receive their notification in the next hour, and call the Mailer with "deliver_later(wait_until:)"

Option A is my favorite but will result in a myriad of scheduled jobs.
Am I missing something? Are there better options?


Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 79,047+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.