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:
parent
ef0055db05
commit
8e9401036c
1 changed files with 8 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue