Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-blockbook account fetch optimisations #15691

Merged
merged 8 commits into from
Dec 3, 2024
Merged

Conversation

tomasklim
Copy link
Member

@tomasklim tomasklim commented Dec 2, 2024

Description

  • do not refresh non-blockbook networks when app is minimised, hidden or browser tab is not active
  • increase refresh rate from 1 minute to 5 minutes for cardano and solana
  • refresh account on enter if it's older than 1 minute
  • migrate sol backends from solanaX.trezor.io to solX.trezor.io so that we can cut old suite versions if needed

TODO: refresh button maybe will be done in some future PRs

@trezor/qa please test that Cardano and Solana accounts are updated every 5 minutes and that they are updated when you enter them (if they are older than 1 minute). You can check networks tab and just filter sol, for cardano you have to check websockets

Copy link

github-actions bot commented Dec 2, 2024

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 16
  • More info

Learn more about 𝝠 Expo Github Action

@tomasklim tomasklim force-pushed the feat/crypto-refresh branch 2 times, most recently from 28d3ae5 to 45ed4d6 Compare December 3, 2024 11:37
export const useWindowVisibility = () => {
const dispatch = useDispatch();

const onWindowVisibilityChange = () => {
Copy link
Member Author

@tomasklim tomasklim Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be possible to extend this by also having state from electron layer. There is one more state only for macOS. You can also detect when app is cover by another app, but that would make it more complicated for now. Let's tested at least using just Page visibility api from renderer layer

const isLessThanDefaultSyncInterval =
Date.now() - updatedAt < DEFAULT_ACCOUNT_SYNC_INTERVAL;

if (!isLessThanDefaultSyncInterval) {
Copy link
Member Author

@tomasklim tomasklim Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is little bit stupid but 1 minute is okay for now, it would be great to have specific refresh time limit for specific chains

@tomasklim tomasklim force-pushed the feat/crypto-refresh branch 3 times, most recently from feabb6d to 21cf04d Compare December 3, 2024 13:22
@tomasklim tomasklim marked this pull request as ready for review December 3, 2024 13:24
@tomasklim tomasklim changed the title chore(suite): redux change resize to window Non-blockbook account fetch optimisations Dec 3, 2024
Copy link
Member

@martykan martykan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@tomasklim tomasklim merged commit f24dab3 into develop Dec 3, 2024
63 of 65 checks passed
@tomasklim tomasklim deleted the feat/crypto-refresh branch December 3, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🤝 Needs QA
Development

Successfully merging this pull request may close these issues.

2 participants