diff options
| author | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-31 21:51:15 +0200 | 
|---|---|---|
| committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-05-31 21:51:15 +0200 | 
| commit | 0dd07a2523fe3a440f4e2a9a0edbdfe57bb70913 (patch) | |
| tree | ec826c23daf0594ba663679c52647b598dced895 | |
| parent | 416923f6594e85bc51956edf758284c3d826773e (diff) | |
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.
| -rwxr-xr-x | include/nms/web.pm | 4 | 
1 files changed, 3 insertions, 1 deletions
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;  | 
