Page MenuHomePhabricator

[Cashtab] Adjust TRIGGER_UTXO_REFRESH_INTERVAL_MS to prevent multiple calls to update
ClosedPublic

Authored by bytesofman on Feb 27 2024, 23:18.

Details

Summary

Have noticed Cashtab load times slowing down. Adding some log statements, could tell the update routine was getting called several times before the interval readjusted.

This is probably due to the React upgrade.

The current system in Cashtab is not the right way to refresh the wallet. We should only call update when we need to, i.e. on app startup and when the wallet receives tx notifications from the websocket. However, some additional refactor work needs to be done for this approach, and the issue is impacting load times in prod rightnow.

Patch while work out the optimization.

Test Plan

npm test, check out dev site at https://cashtab-local-dev.netlify.app/ which has a console.log statement and confirm update called only one time

Diff Detail

Repository
rABC Bitcoin ABC
Branch
better-startup-wallet
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27479
Build 54521: Build Diffcashtab-tests
Build 54520: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist from localforage to context if they are present ======
Error: expect(received).toBe(expected) // Object.is equality

Expected: 10
Received: 50
    at Object.toBe (/work/cashtab/src/hooks/__tests__/useWalletStorage.test.js:61:54)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Each failure log is accessible here:
CashTab Unit Tests: useWallet hook rendering in different localforage states Cashtab loads wallet, settings, cache, and contactlist from localforage to context if they are present

emack added a subscriber: emack.

👍🏼

image.png (44×247 px, 2 KB)

This revision is now accepted and ready to land.Feb 28 2024, 10:15