Covert maps to sync maps in executor fscache to avoid dirty reads (#2105)

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2021-07-08 10:40:17 +05:30
committed by GitHub
parent 74c0142968
commit 2e0bb9304a
4 changed files with 30 additions and 19 deletions
+3 -4
View File
@@ -18,6 +18,7 @@ package fscache
import (
"fmt"
"sync"
"time"
"github.com/pkg/errors"
@@ -68,8 +69,8 @@ type (
byAddress *cache.Cache // address -> function : map[string]metav1.ObjectMeta
byFunctionUID *cache.Cache // function uid -> function : map[string]metav1.ObjectMeta
connFunctionCache *poolcache.Cache // function-key -> funcSvc : map[string]*funcSvc
PodToFsvc map[string]*FuncSvc
WebsocketFsvc map[string]bool
PodToFsvc sync.Map // pod-name -> funcSvc: map[string]*FuncSvc
WebsocketFsvc sync.Map // funcSvc-name -> bool: map[string]bool
requestChannel chan *fscRequest
}
@@ -111,8 +112,6 @@ func MakeFunctionServiceCache(logger *zap.Logger) *FunctionServiceCache {
byFunctionUID: cache.MakeCache(0, 0),
connFunctionCache: poolcache.NewPoolCache(),
requestChannel: make(chan *fscRequest),
PodToFsvc: make(map[string]*FuncSvc),
WebsocketFsvc: make(map[string]bool),
}
go fsc.service()
return fsc