From 7d97e4c3bead329419d594daac11644e14c000e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Kir=C3=B8?= Date: Sun, 20 Mar 2016 20:32:22 +0100 Subject: readability in switch-state --- web/nms.gathering.org/api/public/switch-state | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/nms.gathering.org/api/public/switch-state') diff --git a/web/nms.gathering.org/api/public/switch-state b/web/nms.gathering.org/api/public/switch-state index 38f4c57..62d0078 100755 --- a/web/nms.gathering.org/api/public/switch-state +++ b/web/nms.gathering.org/api/public/switch-state @@ -7,10 +7,11 @@ use strict; use warnings; use Data::Dumper; -my $q = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,data from snmp natural join switches where id in (select max(id) from snmp where ' . $nms::web::when . 'group by switch);'); +my $q = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,data from snmp natural join switches where id in (select max(id) from snmp where ' + . $nms::web::when . 'group by switch);'); $q->execute(); -while (my $ref = $q->fetchrow_hashref()) { +while ( my $ref = $q->fetchrow_hashref() ) { my $sysname = $ref->{'sysname'}; my %data = %{JSON::XS::decode_json($ref->{'data'})}; @@ -37,6 +38,7 @@ while (my $ref = $q->fetchrow_hashref()) { } $json{'switches'}{$sysname}{'time'} = $ref->{'time'}; } + $nms::web::cc{'max-age'} = "5"; $nms::web::cc{'stale-while-revalidate'} = "30"; finalize_output(); -- cgit v1.2.3