discourse/app/jobs/scheduled/process_user_notification_schedules.rb
Alan Guo Xiang Tan 0d8144b62b DEV: Improve logging of errors in Jobs::ProcessUserNotificationSchedules
Gives us the actual error and backtrace to work with. Otherwise, the
logging of the error is not useful at all.
2021-07-21 12:20:44 +08:00

18 lines
458 B
Ruby

# frozen_string_literal: true
module Jobs
class ProcessUserNotificationSchedules < ::Jobs::Scheduled
every 1.day
def execute(args)
UserNotificationSchedule.enabled.includes(:user).each do |schedule|
begin
schedule.create_do_not_disturb_timings
rescue => e
Discourse.warn_exception(e, message: "Failed to process user_notification_schedule with ID #{schedule.id}")
end
end
end
end
end