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

Increase local http cache timeout #115

Merged
merged 1 commit into from
Apr 9, 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 src/repology/repology_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def __init__(self):
# - Limit non-cached requests to 1 request per second
# - Identify this client with custom user-agent
# In addition:
# - Cache all responses locally for 7200 seconds
self.session = CachedLimiterSession(per_second=1, expire_after=7200)
# - Cache all responses locally for 6 hours
self.session = CachedLimiterSession(per_second=1, expire_after=6 * 60 * 60)
ua_product = "repology_cli/0"
ua_comment = "(https://github.com/tiiuae/sbomnix/)"
self.headers = {"User-Agent": f"{ua_product} {ua_comment}"}
Expand Down
3 changes: 2 additions & 1 deletion src/repology/repology_cve.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def query_cve(pkg_name, pkg_version):
Return vulnerabilities known to repology that impact the given package name
and version. Results are returned in pandas dataframe.
"""
session = CachedLimiterSession(per_second=1, expire_after=7200)
# Cache all responses locally for 6 hours
session = CachedLimiterSession(per_second=1, expire_after=6 * 60 * 60)
ua_product = "repology_cli/0"
ua_comment = "(https://github.com/tiiuae/sbomnix/)"
headers = {"User-Agent": f"{ua_product} {ua_comment}"}
Expand Down
3 changes: 2 additions & 1 deletion src/vulnxscan/vulnxscan_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ def report(self, args, sbom_csv):
_repology_cli_dfs = {}
# Rate-limited and cached session. For github api rate limits, see:
# https://docs.github.com/en/rest/search?apiVersion=latest#rate-limit
_session = CachedLimiterSession(per_minute=9, per_second=1, expire_after=7200)
# (caching all responses locally for 6 hours)
_session = CachedLimiterSession(per_minute=9, per_second=1, expire_after=6 * 60 * 60)


def _select_newest(df):
Expand Down
Loading