1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-31 10:20:55 +00:00

Add unique client counting

This commit is contained in:
Kane York 2015-12-23 21:57:33 -08:00
parent 89ff64f52c
commit 81c477cd6b
7 changed files with 374 additions and 1 deletions

View file

@ -64,6 +64,7 @@ func TSetup(flags int, backendChecker *TBackendRequestChecker) (socketserver *ht
if flags&SetupWantSocketServer != 0 {
serveMux := http.NewServeMux()
SetupServerAndHandle(conf, serveMux)
dumpUniqueUsers()
socketserver = httptest.NewServer(serveMux)
}
@ -344,3 +345,11 @@ func TGetUrls(socketserver *httptest.Server, backend *httptest.Server) TURLs {
SavePubMsg: fmt.Sprintf("http://%s/cached_pub", addr),
}
}
func TCheckHLLValue(tb testing.TB, expected uint64, actual uint64) {
high := uint64(float64(expected) * 1.05)
low := uint64(float64(expected) * 0.95)
if actual < low || actual > high {
tb.Errorf("Count outside expected range. Expected %d, Got %d", expected, actual)
}
}