Skip to content

Commit d51aea0

Browse files
committed
increase timeout for trust-prime
1 parent 88bd340 commit d51aea0

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/trustshell/products.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,29 @@ 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(
63+
f"This may take a while with {sbom_count} SBOMs...", style="warning"
64+
)
65+
try:
66+
response = httpx.get(
67+
f"{TRUSTIFY_URL}analysis/component",
68+
headers=auth_header,
69+
timeout=1800, # 30 minutes - increased for large SBOM counts
70+
)
71+
response.raise_for_status()
72+
console.print("Cache priming completed successfully!", style="bold green")
73+
except httpx.TimeoutException:
74+
console.print(
75+
f"Request timed out after 30 minutes. The server may need more time to process {sbom_count} SBOMs.",
76+
style="error",
77+
)
78+
sys.exit(1)
79+
except httpx.HTTPStatusError as e:
80+
console.print(f"HTTP error occurred: {e}", style="error")
81+
sys.exit(1)
82+
except Exception as e:
83+
console.print(f"An error occurred: {e}", style="error")
84+
sys.exit(1)
6385

6486

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

0 commit comments

Comments
 (0)