diff options
author | Kristian Lyngstol <kly@kly@.no> | 2016-03-26 20:21:03 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly@.no> | 2016-03-26 20:21:03 +0100 |
commit | 4b69030c295365df8ffd448288bfdb1ece991227 (patch) | |
tree | 39fa360b861c3f1905acde4f6681db92aa7192ad | |
parent | 96a9bb4c42f4b53020302fea2a46e734c61c0319 (diff) |
NMS: Tweak caching and more
-rw-r--r-- | web/etc/varnish/nms.vcl | 10 | ||||
-rwxr-xr-x | web/nms.gathering.org/api/public/ping | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/web/etc/varnish/nms.vcl b/web/etc/varnish/nms.vcl index 53a9444..8ac8b46 100644 --- a/web/etc/varnish/nms.vcl +++ b/web/etc/varnish/nms.vcl @@ -8,9 +8,17 @@ backend default { .host = "127.0.0.1"; .port = "8080"; } - +acl yoda { + "185.110.148.11"; + "127.0.0.1"; + "::1"; + "2a06:5841:1337::11"; +} # Sort magi. sub vcl_recv { + if (client.ip !~ yoda) { + return (synth(418,"GET RECKT")); + } if (req.url ~ "^/where" || req.url ~ "^/location") { set req.url = "/api/public/location"; } diff --git a/web/nms.gathering.org/api/public/ping b/web/nms.gathering.org/api/public/ping index db46b00..5d1037c 100755 --- a/web/nms.gathering.org/api/public/ping +++ b/web/nms.gathering.org/api/public/ping @@ -4,7 +4,7 @@ use strict; use warnings; use nms::web; -nms::web::setwhen('10s'); +nms::web::setwhen('15s'); my $q = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) (now() - time) as age,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE time in (select max(time) from ping where " . $nms::web::when . " group by switch)"); @@ -32,6 +32,6 @@ while ( my $ref = $lq->fetchrow_hashref() ) { $nms::web::json{'linknets'}{$ref->{'linknet'}} = [ $ref->{'latency1_ms'}, $ref->{'latency2_ms'} ]; } -$nms::web::cc{'max-age'} = "2"; +$nms::web::cc{'max-age'} = "1"; $nms::web::cc{'stale-while-revalidate'} = "15"; finalize_output(); |