2013-08-02 17:31:25 -05:00
|
|
|
module Jobs
|
2013-08-07 12:25:05 -05:00
|
|
|
class DashboardStats < Jobs::Scheduled
|
2014-02-05 17:14:41 -06:00
|
|
|
every 30.minutes
|
2013-08-02 17:31:25 -05:00
|
|
|
|
|
|
|
def execute(args)
|
2016-04-08 15:44:04 -05:00
|
|
|
problems_started_at = AdminDashboardData.problems_started_at
|
|
|
|
if problems_started_at && problems_started_at < 2.days.ago
|
|
|
|
# If there have been problems reported on the dashboard for a while,
|
|
|
|
# send a message to admins no more often than once per week.
|
2017-07-27 20:20:09 -05:00
|
|
|
GroupMessage.create(Group[:admins].name, :dashboard_problems, limit_once_per: 7.days.to_i)
|
2016-04-08 15:44:04 -05:00
|
|
|
end
|
|
|
|
|
2016-04-21 01:45:16 -05:00
|
|
|
AdminDashboardData.refresh_stats
|
2013-08-02 17:31:25 -05:00
|
|
|
end
|
|
|
|
end
|
2013-09-02 02:14:41 -05:00
|
|
|
end
|