1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-03 11:35:00 +01:00

feat: more improvements to analytic and gzips logs for better performance (#3814)

This commit is contained in:
Amir Raminfar
2025-04-17 14:09:06 -07:00
committed by GitHub
parent 061cd0c445
commit 1cf178e37d
16 changed files with 53 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
package web
import (
"compress/gzip"
"context"
"errors"
"regexp"
@@ -111,7 +112,15 @@ func (h *handler) fetchLogsBetweenDates(w http.ResponseWriter, r *http.Request)
lastSeenId = uint32(num)
}
encoder := json.NewEncoder(w)
var encoder *json.Encoder
if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
w.Header().Set("Content-Encoding", "gzip")
writer := gzip.NewWriter(w)
defer writer.Close()
encoder = json.NewEncoder(writer)
} else {
encoder = json.NewEncoder(w)
}
for {
if buffer.Len() > minimum {