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

chore: shrink listing file to speed download times #347

Merged
merged 2 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manager/src/grype_db_manager/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from collections.abc import Generator

DB_SUFFIXES = {".tar.gz", ".tar.zst"}
MAX_DB_AGE = 120 # ~4 months in days
MINIMUM_DB_COUNT = MAX_DB_AGE # number of db entries per schema
MAX_DB_AGE = 3 # old db listings are making the file large and slowing download times
MINIMUM_DB_COUNT = 3 # always include at least 2 databases, no matter how old


def listing_entries_dbs_in_s3(
Expand Down
2 changes: 1 addition & 1 deletion manager/tests/unit/cli/test_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_create_listing(
# contains an application config file
config_dir_path = test_dir_path(f"fixtures/listing/{case_dir}")
listing_s3_mock(config_dir_path, extra_dbs=extra_dbs)
mock_file_age.return_value = 42 # needs to be less than distribution.MAX_DB_AGE
mock_file_age.return_value = 2 # needs to be less than distribution.MAX_DB_AGE

with utils.set_directory(config_dir_path):
with open("expected-listing.json") as f:
Expand Down
Loading