From 0dd07a2523fe3a440f4e2a9a0edbdfe57bb70913 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Tue, 31 May 2016 21:51:15 +0200 Subject: API: Explode max-age as the final act when time traveling Without this the individual endpoints' local overrides would... well... override it. The idea is that any historic data is cached for a very long time. --- include/nms/web.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/nms/web.pm') diff --git a/include/nms/web.pm b/include/nms/web.pm index fcd45b4..6592bfb 100755 --- a/include/nms/web.pm +++ b/include/nms/web.pm @@ -68,7 +68,6 @@ sub setwhen { } if (defined($get_params{'now'})) { $now = "timestamp with time zone 'epoch' + " . db_safe_quote('now') . " * INTERVAL '1 second' "; - $cc{'max-age'} = "3600"; } $now = "(" . $now . " - '" . $offset . "'::interval)"; $when = " time > " . $now . " - '".$window."'::interval and time < " . $now . " "; @@ -85,6 +84,9 @@ sub finalize_output { $json{'time'} = int($query->fetchrow_hashref()->{'time'}); $json{'hash'} = $hash; + if (defined($get_params{'now'})) { + $cc{'max-age'} = "3600"; + } printcc; -- cgit v1.2.3