status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
296 stars 78 forks source link

Missing caching mechanism #9832

Closed Khushboo-dev-cpp closed 1 year ago

Khushboo-dev-cpp commented 1 year ago

Description

Caching mechanism on the go side missing for

  1. Values from Infura and POKT
  2. Collectibles
  3. Values from Cryptocompare and coingecko

If we make calls when the websites are down we receive error saying website is down but we should be receiving cached values on the client side.

Acceptance Criteria

The values from the above websites should be cached and stored

alaibe commented 1 year ago

1 Values are cache for 15 minutes in client side. Caching values from Infura/Pokt => what do we want to cache exactly here? 2 Collectibles could probably suffer from same inconsitency as in infura 3 yes we can add daily cache here

Khushboo-dev-cpp commented 1 year ago

1 Values are cache for 15 minutes in client side. Caching values from Infura/Pokt => what do we want to cache exactly here? 2 Collectibles could probably suffer from same inconsitency as in infura 3 yes we can add daily cache here

so for 1. We need to hold the old token balances etc we have with us, instead of not displaying anything in Asset list, which is what is happening currently in case we restart app with no internet connection. Nothing is shown atm. so it seems nothing is cached. Also caching should occur on go side?

  1. I am not sure what you mean by that?
Khushboo-dev-cpp commented 1 year ago

We also need to make sure that in case market values are down, atleast the asset values which are still available are passed back, currently the entire list is returned as empty.

Khushboo-dev-cpp commented 1 year ago

incase I restrictic connection to cryptocommpare, currently this error is seen when calling getWalletToken

ERR 2023-03-14 19:50:17.788+01:00 rpc response error topics="rpc" tid=26395 file=core.nim:36 err="\nstatus-go error [methodName:wallet_getWalletToken, code:-32000, message:fallback failed with \'json: cannot unmarshal object into Go value of type []coingecko.GeckoMarketValues\'. run error was \'Get \"https://min-api.cryptocompare.com/data/pricemultifull?fsyms=TNT,HEZ,GNT,DCN,POWR,XEENUS,LINK,AMB,TCAD,CFI,LPT,ATM,STORJ,UBT,DGX,ABYSS,TUSD,WTC,SUB,CENTRA,LINK,EKO,STORM,ZEENUS,ELF,CSNO,COMP,LXS,CND,UPP,QRL,BLZ,EOS,MANA,NEXO,SAI,BAND,TGBP,UBI,LEND,POE,ROL,USDT,GEN,LRC,RHOC,FXC,ADI,SPIKE,HND,FUEL,XPA,QSP,POLY,DTA,BLT,MOKSHA,XRL,R,CDAI,SAN,HT,BNT,XDATA,CRV,MGO,ANT,STX,ADX,MLN,MOD,USDS,RLC,AE,BRLN,CDT,AVT,REN,SPANK,DRT,DAI,OMG,PT,KNC,TKN,FRAX,SNM,GRID,ZSC,REQ,VGX,ST,TGT,PPT,ENG,TRST,AUSDC,TRX,PAY,BTM,RDN,SNGLS,ZRX,OTN,SNX,BNB,SPN,GRT,ABT,GLM,MET,PLR,XAUR,DGD,VERI,VIB,MTL,1ST,RARE,QKC,UKG,TIME,AMPL,MCO,WBTC,MKR,SOCKS,FUN,ETH2X-FLI,WIBB,WETH,NMR,DAT,PPP,WGN,YEENUS,RCN,GNO,UNI,MFG,TAAS,SALT,KIN,EDO,ICN,PRG,CVC,APPC,MDS,OGN,USDP,RAE,EDG,NPXS,WINGS,MDA,MTH,DLT,PAXG,COB,MOC,SUSD,ICOS,VRS,AST,DNT,TAUD,USDC,BAL,LOOM,SNT,DPY,ENJ,WABI,BUFF,OXT,REP,HST,ENS,AKRO,IOST,BTU,BAT,SNT,USDD,EVX,ETH&tsyms=USD&extraParams=Status.im\": dial tcp 127.0.0.1:443: connect: connection refused\' ]\n"

Khushboo-dev-cpp commented 1 year ago

We should also consider adding a way to inform UI in case the values are cached or not. we need this to show error states on the UI

dlipicar commented 1 year ago

Finished by this PR: https://github.com/status-im/status-desktop/pull/12161 Collcetibles cache is now in status-go, and the client can know if there's cache available (and the timestamp of the last successful query) for any given filter.