From 49ac23efc2d6719a5cbb5b01b2a778c77208883a Mon Sep 17 00:00:00 2001 From: Kitipong Sirirueangsakul Date: Thu, 14 Sep 2023 23:42:17 +0700 Subject: [PATCH] remove cache --- yoda/context.go | 2 -- yoda/execute.go | 8 +------- yoda/run.go | 2 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/yoda/context.go b/yoda/context.go index a623bfc16..607957d98 100644 --- a/yoda/context.go +++ b/yoda/context.go @@ -1,7 +1,6 @@ package yoda import ( - "sync" "sync/atomic" "time" @@ -45,7 +44,6 @@ type Context struct { freeKeys chan int64 keyRoundRobinIndex int64 // Must use in conjunction with sync/atomic - dataSourceCache *sync.Map pendingRequests map[types.RequestID]bool metricsEnabled bool diff --git a/yoda/execute.go b/yoda/execute.go index b96c428ac..5a5cba2be 100644 --- a/yoda/execute.go +++ b/yoda/execute.go @@ -222,10 +222,6 @@ func GetExecutable(c *Context, l *Logger, hash string) ([]byte, error) { // GetDataSourceHash fetches data source hash by id func GetDataSourceHash(c *Context, l *Logger, id types.DataSourceID) (string, error) { - if hash, ok := c.dataSourceCache.Load(id); ok { - return hash.(string), nil - } - res, err := abciQuery(c, l, fmt.Sprintf("/store/%s/key", types.StoreKey), types.DataSourceStoreKey(id)) if err != nil { l.Error(":skull: Failed to get data source with error: %s", c, err.Error()) @@ -235,9 +231,7 @@ func GetDataSourceHash(c *Context, l *Logger, id types.DataSourceID) (string, er var d types.DataSource cdc.MustUnmarshal(res.Response.Value, &d) - hash, _ := c.dataSourceCache.LoadOrStore(id, d.Filename) - - return hash.(string), nil + return d.Filename, nil } // GetRequest fetches request by id diff --git a/yoda/run.go b/yoda/run.go index a40609688..52d7095e2 100644 --- a/yoda/run.go +++ b/yoda/run.go @@ -4,7 +4,6 @@ import ( "context" "errors" "path/filepath" - "sync" "time" "github.com/cosmos/cosmos-sdk/client/flags" @@ -157,7 +156,6 @@ func runCmd(c *Context) *cobra.Command { c.pendingMsgs = make(chan ReportMsgWithKey) c.freeKeys = make(chan int64, len(keys)) c.keyRoundRobinIndex = -1 - c.dataSourceCache = new(sync.Map) c.pendingRequests = make(map[types.RequestID]bool) c.metricsEnabled = cfg.MetricsListenAddr != "" return runImpl(c, l)