File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1- FROM golang:1.17 -alpine as build
1+ FROM golang:1.23 -alpine AS build
22
33ARG CGO_ENABLED=0
44
@@ -12,14 +12,14 @@ RUN go mod download
1212
1313COPY . .
1414
15- FROM build as build-sidecar
15+ FROM build AS build-sidecar
1616
1717ARG CGO_ENABLED=0
1818
1919RUN go build -ldflags="-s -w" -o /cache-server main_container.go \
2020 && upx --best --lzma /cache-server
2121
22- FROM build as build-extension
22+ FROM build AS build-extension
2323
2424ARG CGO_ENABLED=0
2525
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ type CacheData struct {
2727 CacheExpiry time.Time
2828}
2929
30- var mutex = & sync.Mutex {}
30+ var mutex = & sync.RWMutex {}
3131
3232func IsExpired (cacheExpiry time.Time ) bool {
3333 return cacheExpiry .Before (time .Now ())
@@ -48,9 +48,14 @@ func GetCacheExpiry() time.Time {
4848}
4949
5050func GetSecretCache (name string , refresh string ) string {
51+ mutex .RLock ()
5152 secret := secretCache [name ]
53+ mutex .RUnlock ()
54+
55+ println ("GetSecretCache: " , name )
5256
5357 if IsExpired (secret .CacheData .CacheExpiry ) || refresh == "1" {
58+ println ("GetSecretCache: refresh" )
5459 mutex .Lock ()
5560 secretCache [name ] = Secret {
5661 CacheData : CacheData {
You can’t perform that action at this time.
0 commit comments