PERF: use cached reports for dashboard if available

This commit is contained in:
Sam 2018-05-14 12:01:44 +10:00
parent 5f54b005a1
commit bc9e0d46af
2 changed files with 3 additions and 1 deletions

View File

@ -2,7 +2,7 @@ require 'disk_space'
class Admin::DashboardNextController < Admin::AdminController
def index
dashboard_data = AdminDashboardNextData.fetch_stats
dashboard_data = AdminDashboardNextData.fetch_cached_stats
dashboard_data[:disk_space] = DiskSpace.cached_stats
render json: dashboard_data
end

View File

@ -14,7 +14,9 @@ module Jobs
GroupMessage.create(Group[:admins].name, :dashboard_problems, limit_once_per: 7.days.to_i)
end
# TODO: decide if we want to keep caching this every 30 minutes
AdminDashboardData.refresh_stats
AdminDashboardNextData.refresh_stats
end
end
end