Skip to content

misc: Move cache initialization to startup script #2260

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

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

adamantike
Copy link
Contributor

Description
Guarantee that cache is initialized during startup, and only once, instead of every time a MetadataHandler object is instantiated.

Also, improve logic to determine fixtures paths.

Checklist

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Guarantee that cache is initialized during startup, and only once,
instead of every time a `MetadataHandler` object is instantiated.

Also, improve logic to determine `fixtures` paths.
@adamantike adamantike requested review from gantoine and zurdi15 August 13, 2025 15:28
Copy link

trunk-io bot commented Aug 13, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link

Test Results

547 tests   - 1   546 ✅  - 1   58s ⏱️ -1s
  1 suites ±0     1 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 80291f4. ± Comparison against base commit 57e9a9f.

This pull request removes 4 and adds 3 tests. Note that renamed tests count towards both.
tests.handler.metadata.test_base_handler.TestConditionallySetCache ‑ test_cache_exists_skips_loading
tests.handler.metadata.test_base_handler.TestConditionallySetCache ‑ test_cache_not_exists_loads_data
tests.handler.metadata.test_base_handler.TestConditionallySetCache ‑ test_exception_handling
tests.handler.metadata.test_base_handler.TestMetadataHandlerInit ‑ test_init_calls_cache_setup
tests.utils.test_cache.TestConditionallySetCache ‑ test_cache_exists_skips_loading
tests.utils.test_cache.TestConditionallySetCache ‑ test_cache_not_exists_loads_data
tests.utils.test_cache.TestConditionallySetCache ‑ test_exception_handling

Copy link

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
8782 6191 71% 0% 🟢

New Files

File Coverage Status
backend/utils/cache.py 100% 🟢
TOTAL 100% 🟢

Modified Files

File Coverage Status
backend/handler/metadata/base_hander.py 99% 🟢
backend/models/firmware.py 78% 🟢
backend/startup.py 46% 🟢
TOTAL 74% 🟢

updated for commit: 80291f4 by action🐍

Copy link
Member

@gantoine gantoine left a comment

Choose a reason for hiding this comment

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

yessss very nice

@adamantike adamantike merged commit 1b5fca6 into master Aug 13, 2025
9 checks passed
@adamantike adamantike deleted the misc/move-cache-initialization-to-startup-script branch August 13, 2025 18:16
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