5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 16:01:41 +00:00

cachear los resultados hasta la próxima actualización

This commit is contained in:
f 2021-10-08 18:38:02 -03:00
parent ef0055db05
commit 8e9401036c

View file

@ -25,17 +25,18 @@ class StatsController < ApplicationController
# Genera un gráfico de visitas por dominio asociado a este sitio
def host
@stats = Rollup.where_dimensions(host: hostnames).multi_series('host', interval: interval).tap do |series|
series.each do |serie|
serie[:name] = serie.dig(:dimensions, 'host')
serie[:data].transform_values! do |value|
value * nodes
if stale? [last_stat, hostnames, interval]
stats = Rollup.where_dimensions(host: hostnames).multi_series('host', interval: interval).tap do |series|
series.each do |serie|
serie[:name] = serie.dig(:dimensions, 'host')
serie[:data].transform_values! do |value|
value * nodes
end
end
end
end
render json: @stats
render json: stats
end
private