From 245ffc404f82b6f6f5d0395f96716aea488d70b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Thu, 22 Feb 2024 14:49:24 +0100 Subject: [PATCH] comment out caching to test --- tools/walletextension/wallet_extension.go | 44 +++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/walletextension/wallet_extension.go b/tools/walletextension/wallet_extension.go index df3af1ed9d..2abf741879 100644 --- a/tools/walletextension/wallet_extension.go +++ b/tools/walletextension/wallet_extension.go @@ -108,25 +108,25 @@ func (w *WalletExtension) ProxyEthRequest(request *common.RPCRequest, conn userc requestStartTime := time.Now() // Check if the request is in the cache - isCacheable, key, ttl := cache.IsCacheable(request) - - // in case of cache hit return the response from the cache - if isCacheable { - if value, ok := w.cache.Get(key); ok { - // do a shallow copy of the map to avoid concurrent map iteration and map write - returnValue := make(map[string]interface{}) - for k, v := range value { - returnValue[k] = v - } - - requestEndTime := time.Now() - duration := requestEndTime.Sub(requestStartTime) - // adjust requestID - returnValue[common.JSONKeyID] = request.ID - w.fileLogger.Info(fmt.Sprintf("Request method: %s, request params: %s, encryptionToken of sender: %s, response: %s, duration: %d ", request.Method, request.Params, hexUserID, returnValue, duration.Milliseconds())) - return returnValue, nil - } - } + //isCacheable, key, ttl := cache.IsCacheable(request) + // + //// in case of cache hit return the response from the cache + //if isCacheable { + // if value, ok := w.cache.Get(key); ok { + // // do a shallow copy of the map to avoid concurrent map iteration and map write + // returnValue := make(map[string]interface{}) + // for k, v := range value { + // returnValue[k] = v + // } + // + // requestEndTime := time.Now() + // duration := requestEndTime.Sub(requestStartTime) + // // adjust requestID + // returnValue[common.JSONKeyID] = request.ID + // w.fileLogger.Info(fmt.Sprintf("Request method: %s, request params: %s, encryptionToken of sender: %s, response: %s, duration: %d ", request.Method, request.Params, hexUserID, returnValue, duration.Milliseconds())) + // return returnValue, nil + // } + //} // proxyRequest will find the correct client to proxy the request (or try them all if appropriate) var rpcResp interface{} @@ -172,9 +172,9 @@ func (w *WalletExtension) ProxyEthRequest(request *common.RPCRequest, conn userc w.fileLogger.Info(fmt.Sprintf("Request method: %s, request params: %s, encryptionToken of sender: %s, response: %s, duration: %d ", request.Method, request.Params, hexUserID, response, duration.Milliseconds())) // if the request is cacheable, store the response in the cache - if isCacheable { - w.cache.Set(key, response, ttl) - } + //if isCacheable { + // w.cache.Set(key, response, ttl) + //} return response, nil }