From 2ddfa2b02cdf6a8e6f91bc45b633604e1d6ffd9b Mon Sep 17 00:00:00 2001 From: Kane York Date: Wed, 23 Dec 2015 22:18:11 -0800 Subject: [PATCH] Add /hll_force_write --- socketserver/server/handlecore.go | 1 + socketserver/server/usercount.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/socketserver/server/handlecore.go b/socketserver/server/handlecore.go index 451b9223..49d73c53 100644 --- a/socketserver/server/handlecore.go +++ b/socketserver/server/handlecore.go @@ -88,6 +88,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) { serveMux.Handle("/.well-known/", http.FileServer(http.Dir("/tmp/letsencrypt/"))) serveMux.HandleFunc("/stats", HTTPShowStatistics) serveMux.HandleFunc("/hll/", HTTPShowHLL) + serveMux.HandleFunc("/hll_force_write", HTTPWriteHLL) serveMux.HandleFunc("/drop_backlog", HTTPBackendDropBacklog) serveMux.HandleFunc("/uncached_pub", HTTPBackendUncachedPublish) diff --git a/socketserver/server/usercount.go b/socketserver/server/usercount.go index 9ac614fa..44ad68e3 100644 --- a/socketserver/server/usercount.go +++ b/socketserver/server/usercount.go @@ -164,6 +164,12 @@ func HTTPShowHLL(w http.ResponseWriter, r *http.Request) { hllFileServer.ServeHTTP(w, r) } +func HTTPWriteHLL(w http.ResponseWriter, r *http.Request) { + writeAllHLLs() + w.WriteHeader(200) + w.Write([]byte("ok")) +} + // loadUniqueUsers loads the previous HLLs into memory. // is_init_func func loadUniqueUsers() {