Search code examples
ruby-on-railsruby-on-rails-4scheduled-taskssidekiq

Rails 4 Schedule Emails in the future with Sidekiq


Users can schedule a meeting in a Rails 4 app, and I would like to be able to send Email reminders one hour before the meeting starts.

I use Sidekiq to process emails in the background, which has the functionality

SomeWorker.perform_at

But all the examples use easy future dates such as

5.days.from_now
3.hour.from_now

Whereas, when a meeting is created and starts on "05/27/2016 02:30 PM", I would like to schedule emails on "05/27/2016 01:30 PM".

Any recommended approach for that kind of tasks with Sidekiq, or should I use Sidekiq with another gem for schedules?


Solution

  • SomeWorker.perform_at(@meeting.starts_on - 1.hour, @meeting.id)