Bedrock-OSS / regolith

Bedrock Addons compiler pipeline.
https://bedrock-oss.github.io/regolith/
MIT License
56 stars 17 forks source link

Implement global cache for filters #263

Closed stirante closed 1 year ago

stirante commented 1 year ago

This PR introduces a global cache for filter repositories to enhance the performance and efficiency of filter installations and version switching.

Key features included in this PR:

  1. When a filter is installed, the entire repository containing the filter is cached in Regolith's app data directory. This speeds up subsequent installations and updates.
  2. To switch between filter versions, the git checkout command is utilized, ensuring seamless version transitions.
  3. By default, the cache is updated using git fetch after a minimum of 5 minutes has elapsed since the last update. This prevents excessive fetching and optimizes performance.
  4. The cooldown duration between cache updates can be configured using the filter_cache_update_cooldown option in the configuration file. This allows users to fine-tune the cache update frequency based on their specific needs.
  5. A forced cache refresh can be initiated by including the --force-filter-refresh flag when using the install or install-all subcommands.
Nusiq commented 1 year ago

I think regolith clean --user-cache which currently cleans the cached project data for the users that use the use_project_app_data_storage setting, should also clean the filter cache defined in this PR.

Nusiq commented 1 year ago

Regolith crashed when I was using this version on a private project. I need to test it later.

EDIT: The development version also crashes regolith. I'm not sure what's the issue but I found out that we lack error handling here: https://github.com/Bedrock-OSS/regolith/blob/dd0dfe884fa02623510e3fe50e747afb8d21a613/regolith/file_system.go#L298

EDIT 2: I fixed the issue with this PR: https://github.com/Bedrock-OSS/regolith/pull/265