Skip to content

Commit

Permalink
Merge branch 'release/v2.5.x' of https://github.com/bandprotocol/chain
Browse files Browse the repository at this point in the history
…into extra-rest/v2.5.x
  • Loading branch information
RogerKSI committed Sep 14, 2023
2 parents 87f2473 + e6548bb commit fed540d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
2 changes: 0 additions & 2 deletions yoda/context.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package yoda

import (
"sync"
"sync/atomic"
"time"

Expand Down Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions yoda/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions yoda/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"path/filepath"
"sync"
"time"

"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fed540d

Please sign in to comment.