fix: rare race condition in etag cache when serving webui

This commit is contained in:
Gareth George
2025-01-07 20:46:40 -08:00
parent 66bba33809
commit 0e083c1aea
+4
View File
@@ -8,12 +8,16 @@ import (
"io/fs"
"net/http"
"strings"
"sync"
"time"
)
var etagCacheMu sync.Mutex
var etagCache = make(map[string]string)
func calcEtag(path string, data []byte) string {
etagCacheMu.Lock()
defer etagCacheMu.Unlock()
etag, ok := etagCache[path]
if ok {
return etag