From 822e6642777858d1297f2f8dc869b393f01dbf52 Mon Sep 17 00:00:00 2001 From: KamiD <44460798+KamiD@users.noreply.github.com> Date: Wed, 2 Jun 2021 15:19:14 +0800 Subject: [PATCH] change lru to lru.cache to make sure thread safe (#894) --- x/evm/watcher/querier.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/evm/watcher/querier.go b/x/evm/watcher/querier.go index 9ce5bc28aa..11f764e962 100644 --- a/x/evm/watcher/querier.go +++ b/x/evm/watcher/querier.go @@ -6,7 +6,7 @@ import ( "errors" "strconv" - "github.com/hashicorp/golang-lru/simplelru" + lru "github.com/hashicorp/golang-lru" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" @@ -22,7 +22,7 @@ const MsgFunctionDisable = "fast query function has been disabled" type Querier struct { store *WatchStore sw bool - lru *simplelru.LRU + lru *lru.Cache } func (q Querier) enabled() bool { @@ -34,7 +34,7 @@ func (q *Querier) Enable(sw bool) { } func NewQuerier() *Querier { - lru, e := simplelru.NewLRU(GetWatchLruSize(), nil) + lru, e := lru.New(GetWatchLruSize()) if e != nil { panic(errors.New("Failed to init LRU Cause " + e.Error())) }