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

feat: Optimize NetService related performances #1267

Open
wants to merge 2 commits into
base: feat/delay_nonimportant_calls
Choose a base branch
from

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Dec 19, 2024

This PR add caching for the isOnline() method and also change the way NetService is initialized to prevent unwanted calls to google's servers

### ✨ Features

*

### πŸ› Bug Fixes

*

### πŸ”§ Tech

*

@Ldoppea Ldoppea changed the base branch from master to feat/delay_nonimportant_calls December 19, 2024 17:30
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 8968982 to 7b1a62f Compare December 20, 2024 14:24
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from 000a188 to 5b4bd63 Compare December 20, 2024 14:25
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 7b1a62f to 9ca8720 Compare December 20, 2024 14:30
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from 5b4bd63 to f04e814 Compare December 20, 2024 14:30
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 9ca8720 to bace560 Compare December 20, 2024 16:43
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from f04e814 to f64f70c Compare December 20, 2024 16:43
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from bace560 to eb60cf2 Compare December 20, 2024 17:32
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from f64f70c to 5c8b9fb Compare December 20, 2024 17:32
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from eb60cf2 to 5ae845f Compare December 20, 2024 19:37
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from 5c8b9fb to 06803ec Compare December 20, 2024 19:37
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 5ae845f to 1cba83b Compare December 20, 2024 19:55
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from 06803ec to 16d9827 Compare December 20, 2024 19:55
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 1cba83b to 9173b36 Compare December 20, 2024 20:09
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from 16d9827 to efa5e6b Compare December 20, 2024 20:09
With previous implementation, NetService would be configured too late
and so it would have time to do reachability test on google servers
before we configure it with Cozy's servers

This commit move the configuration outside of the React components and
so we ensure it is called as soon as possible
With previous implementation, NetService would do reachability tests
too often and sometimes multiple times in parallel (as we can call
`isOnline` from multiple parallel `client.query()` calls)

This is problematic as it can unnecessary slow down the app processes

This commit caches the isOnline result and register to the `NetInfo`
event listener so stay up-to-date, so we can drastically reduce
reachability tests on Cozy's servers
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 9173b36 to 67b3e0e Compare December 20, 2024 20:20
@Ldoppea Ldoppea force-pushed the feat/improve_netservice branch from efa5e6b to 39ddcc4 Compare December 20, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants