Skip to content

Conversation

VictoriousRaptor
Copy link
Contributor

@VictoriousRaptor VictoriousRaptor commented May 7, 2023

Changes

  • Make use of cache. Add expiration time (30 hours) to program cache on disk.
    • 24 hours is too short. If I turn on my PC about the same time everyday I'd have a 50% to index every time. 30 hours is basically bi-daily.
    • Note that it doesn't immediately refresh cache when it expires. i.e. If you keep Flow running for more than 30 hours it doesn't reindex. Next reindex is done on next startup. This is intended because this PR is focused on reducing CPU and disk usage during init.
  • Stop indexing on init when cache on disk existing and not expired. Significantly reduce CPU and disk usage.
  • Save cache right after indexing.

Tests

  • Cache can be saved and loaded.
  • No indexing on init when cache is not expired.
  • Indexing is done on a first-time startup.

No longer await on first run (no cache detected) to speed up boost
30 hours cache life
@VictoriousRaptor VictoriousRaptor self-assigned this May 7, 2023
@taooceros
Copy link
Member

I remember one reason the reindex is performed at startup is that if flow is closed, and someone else install a program during it, and open flow, the new installed program will not shown up.

@VictoriousRaptor
Copy link
Contributor Author

I remember one reason the reindex is performed at startup is that if flow is closed, and someone else install a program during it, and open flow, the new installed program will not shown up.

Yeah truly. But for many users they just set Flow to auto startup and leave it running all day so any installation should be detected and triggering an reindex.

@taooceros
Copy link
Member

Though I agree reindex every time startup is kindly very expensive....since now we have file watcher maybe this change it good.

@taooceros
Copy link
Member

I remember one reason the reindex is performed at startup is that if flow is closed, and someone else install a program during it, and open flow, the new installed program will not shown up.

Yeah truly. But for many users they just set Flow to auto startup and leave it running all day so any installation should be detected and triggering an reindex.

Yes I agree. Reindex at startup somehow make restart a painful thing to do.

@taooceros taooceros requested a review from onesounds May 7, 2023 03:39
@VictoriousRaptor
Copy link
Contributor Author

Maybe an option to choose force index on startup (default should be false)? And an option to set expiration time?

@VictoriousRaptor VictoriousRaptor changed the title Refactor program cache logic Reduce CPU and disk usage during Program plugin init May 7, 2023
@jjw24 jjw24 added the bug Something isn't working label May 14, 2023
@jjw24 jjw24 added this to the 1.15.1 milestone May 14, 2023
@jjw24
Copy link
Member

jjw24 commented May 14, 2023

I remember one reason the reindex is performed at startup is that if flow is closed, and someone else install a program during it, and open flow, the new installed program will not shown up.

@taooceros would file watcher trigger an update since it will have detected change?

@VictoriousRaptor
Copy link
Contributor Author

I remember one reason the reindex is performed at startup is that if flow is closed, and someone else install a program during it, and open flow, the new installed program will not shown up.

@taooceros would file watcher trigger an update since it will have detected change?

No. File watcher only watches changes when Flow is running.

@taooceros
Copy link
Member

You are right...it's too annoying when debugging....

@VictoriousRaptor VictoriousRaptor merged commit 6655d83 into Flow-Launcher:dev Jun 11, 2023
@VictoriousRaptor VictoriousRaptor deleted the BoostProgramInit branch June 11, 2023 09:41
@jjw24 jjw24 modified the milestones: 1.15.1, 1.16.0 Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants