ruby - How to send notifications according to time zone in rails? -
i trying send push notifications rails applications scheduled every 7th day @ 10am cronjob using whenever gem.
problem have users different time zones. us,eu,aus,ind etc. if trigger utc time 10 users might notifications @ midnight, that's awful thing disturb someone's sleep.
what can schedule every timezoneuser receive notification @ 10am of timezone.
i saving timezone every user.
user_id time_zone 153 +10:00 155 +05:30
i schedule job run every hour desired day of week, check users have time 10am , send them. way run job 24 times in 1 day of week covering whole world timezones.
every '0 * * * 1' # send notification users @ 10am end
in above example, 0 * * * 1
corresponding. (at minute 0) (every hour) (every day) (every month) (first day of week -monday-)
if want send notification on sunday example number should 7
, tuesday 2
, on.
Comments
Post a Comment