Skip to content

Commit 42e099b

Browse files
committed
increase timeout for trust-prime
1 parent 962425b commit 42e099b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/trustshell/products.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,27 @@ def prime_cache(check: bool, debug: bool) -> None:
5959
console.print(f"sbom_count: {sbom_count}")
6060
if not check:
6161
console.print("Priming graph cache...")
62-
httpx.get(f"{TRUSTIFY_URL}analysis/component", headers=auth_header, timeout=300)
62+
console.print(f"This may take a while with {sbom_count} SBOMs...", style="warning")
63+
try:
64+
response = httpx.get(
65+
f"{TRUSTIFY_URL}analysis/component",
66+
headers=auth_header,
67+
timeout=1800 # 30 minutes - increased for large SBOM counts
68+
)
69+
response.raise_for_status()
70+
console.print("Cache priming completed successfully!", style="bold green")
71+
except httpx.TimeoutException:
72+
console.print(
73+
f"Request timed out after 30 minutes. The server may need more time to process {sbom_count} SBOMs.",
74+
style="error"
75+
)
76+
sys.exit(1)
77+
except httpx.HTTPStatusError as e:
78+
console.print(f"HTTP error occurred: {e}", style="error")
79+
sys.exit(1)
80+
except Exception as e:
81+
console.print(f"An error occurred: {e}", style="error")
82+
sys.exit(1)
6383

6484

6585
@click.command(context_settings={"help_option_names": ["-h", "--help"]})

0 commit comments

Comments
 (0)