mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-08-28 11:56:28 +00:00
fix: rare race condition in etag cache when serving webui
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user