1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-12 17:10:54 +00:00

Add Health to /stats, add irc reconnect

This commit is contained in:
Kane York 2016-06-02 08:16:16 -07:00
parent 88b356177a
commit d49c88a222
4 changed files with 63 additions and 9 deletions

View file

@ -94,6 +94,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
serveMux.HandleFunc("/", HTTPHandleRootURL)
serveMux.Handle("/.well-known/", http.FileServer(http.Dir("/tmp/letsencrypt/")))
serveMux.HandleFunc("/healthcheck", HTTPSayOK)
serveMux.HandleFunc("/stats", HTTPShowStatistics)
serveMux.HandleFunc("/hll/", HTTPShowHLL)
serveMux.HandleFunc("/hll_force_write", HTTPWriteHLL)
@ -113,6 +114,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
log.Println("could not announce startup to backend:", err)
} else {
resp.Body.Close()
lastBackendSuccess[bPathAnnounceStartup] = time.Now()
}
if Configuration.UseESLogStashing {
@ -167,7 +169,7 @@ func shutdownHandler() {
func dumpStackOnCtrlZ() {
ch := make(chan os.Signal)
signal.Notify(ch, syscall.SIGTSTP)
for _ = range ch {
for range ch {
fmt.Println("Got ^Z")
buf := make([]byte, 10000)
@ -176,6 +178,13 @@ func dumpStackOnCtrlZ() {
}
}
// HTTPSayOK replies with 200 and a body of "ok\n".
func HTTPSayOK(w http.ResponseWriter, _ *http.Request) {
w.(interface {
WriteString(string) error
}).WriteString("ok\n")
}
// SocketUpgrader is the websocket.Upgrader currently in use.
var SocketUpgrader = websocket.Upgrader{
ReadBufferSize: 1024,