Skip to content

Commit

Permalink
disable cache temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj committed Feb 20, 2024
1 parent 7fa28d0 commit caee9c7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tools/walletextension/wallet_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,20 @@ func (w *WalletExtension) ProxyEthRequest(request *common.RPCRequest, conn userc
// start measuring time for request
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 {
requestEndTime := time.Now()
duration := requestEndTime.Sub(requestStartTime)
w.fileLogger.Info(fmt.Sprintf("Request method: %s, request params: %s, encryptionToken of sender: %s, response: %s, duration: %d ", request.Method, request.Params, hexUserID, value, duration.Milliseconds()))
// adjust requestID
value[common.JSONKeyID] = request.ID
return value, nil
}
}
//// 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 {
// requestEndTime := time.Now()
// duration := requestEndTime.Sub(requestStartTime)
// w.fileLogger.Info(fmt.Sprintf("Request method: %s, request params: %s, encryptionToken of sender: %s, response: %s, duration: %d ", request.Method, request.Params, hexUserID, value, duration.Milliseconds()))
// // adjust requestID
// value[common.JSONKeyID] = request.ID
// return value, nil
// }
//}

// proxyRequest will find the correct client to proxy the request (or try them all if appropriate)
var rpcResp interface{}
Expand Down Expand Up @@ -166,9 +166,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
}
Expand Down

0 comments on commit caee9c7

Please sign in to comment.