File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -69,17 +69,8 @@ def _is_transient_error(exc: Exception) -> bool:
6969 return False
7070
7171
72- def retry_on_transient_error (max_retries = 3 , base_delay = 2.0 , max_delay = 30.0 ):
73- """Retry a flaky integration test with exponential backoff.
74-
75- Apply to tests that hit the Stream API and can fail due to rate limits,
76- resource limits, or transient infrastructure errors.
77-
78- Args:
79- max_retries: Maximum number of retry attempts.
80- base_delay: Initial delay in seconds (doubles each attempt).
81- max_delay: Cap on the delay between retries.
82- """
72+ def retry_on_transient_error (max_retries = 3 , backoff = 1.0 ):
73+ """Decorator that retries a test on transient infrastructure errors."""
8374
8475 def decorator (func ):
8576 @functools .wraps (func )
@@ -91,8 +82,7 @@ def wrapper(*args, **kwargs):
9182 except Exception as exc :
9283 if attempt < max_retries and _is_transient_error (exc ):
9384 last_exc = exc
94- delay = min (base_delay * (2 ** attempt ), max_delay )
95- time .sleep (delay )
85+ time .sleep (backoff * (attempt + 1 ))
9686 continue
9787 raise
9888 raise last_exc
You can’t perform that action at this time.
0 commit comments