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 startup timings by delaying heavy tasts #1266

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

Ldoppea
Copy link
Member

@Ldoppea Ldoppea commented Dec 19, 2024

This PR's goal is to improve startup timings by delaying heavy tasks after the startup is complete.

What have been delayed:

  • PouchDB replication
  • Important files downloading (for offline access)
  • Call to Oauth client's synchronize() api
  • Downloading of cozy-app icons for opening animations

For now those delay have been hardcoded, but in the future we may want to implement some "orchestrator" mechanism that would be responsible to call those tasks when the application is IDLE

### ✨ Features

* Improve startup timings

### 🐛 Bug Fixes

*

### 🔧 Tech

*

@Ldoppea Ldoppea changed the title Feat/delay nonimportant calls feat: Optimize startup timings by delaying heavy tasts Dec 19, 2024
Copy link
Contributor

@zatteo zatteo left a comment

Choose a reason for hiding this comment

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

Nice optimization!

@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/delay_nonimportant_calls branch from 7b1a62f to 9ca8720 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/delay_nonimportant_calls branch from bace560 to eb60cf2 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/delay_nonimportant_calls branch from 5ae845f to 1cba83b 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/delay_nonimportant_calls branch from 9173b36 to 67b3e0e Compare December 20, 2024 20:20
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from 67b3e0e to c94cce5 Compare January 9, 2025 10:51
@Ldoppea Ldoppea force-pushed the feat/mmkv branch 2 times, most recently from 37dc032 to 241c126 Compare January 17, 2025 10:20
Base automatically changed from feat/mmkv to feat/meta_offline January 17, 2025 10:28
In #1209 we added CozyPouchLink to CozyClient's instance

By default CozyPouchLink starts replicating all its database directly
after being initialized

This is problematic as this happens during the App's startup and so it
will unnecessary slow the startup process

This is unnecessary because on startup, either the app is offline and
so replication cannot be done, either the app is online and so it will
use the cozy-stack. So replication can be delayed

We want to defer the replication to a short delay after the startup
(for now 30s)
Downloading important files on startup may slow down the startup
process, so we want to delay it (for now 30s after the startup)
Call to `synchronize()` may slow down the startup process but is not
necessary for the app to work

It is here only to update the cozy-settings's OAuth clients list to
display the last connexion to the app

So we chose to delay this call a short delay after the startup (for now
10s)

By doing so, we may fail calling the `synchronize()` method if the user
closes the app less than 10s after opening it, but as this is used only
for display purpose, we chose to consider this as not-critical
Icons caching may slow down the startup process but is not necessary
for the app to work

If not called in time, this would only impact cozy-apps opening
animation that will use generic icons (if never called before) or
potentially old icons (in the rare cases when we update a cozy-app
icon)

So we chose to delay this call a short delay after the startup (for now
30s)
@Ldoppea Ldoppea force-pushed the feat/delay_nonimportant_calls branch from c94cce5 to 630aa42 Compare January 17, 2025 10:29
@Ldoppea Ldoppea merged commit 008c77a into feat/meta_offline Jan 17, 2025
1 check passed
@Ldoppea Ldoppea deleted the feat/delay_nonimportant_calls branch January 17, 2025 10:37
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