Skip to content

Commit

Permalink
fix poetry formatt and update the other part of the code
Browse files Browse the repository at this point in the history
  • Loading branch information
abiodun0 committed Oct 4, 2024
1 parent bb02009 commit e782dcd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions unique_sdk/unique_sdk/_api_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ def _static_request(
raise RetryError(f"Failed after {max_retries} attempts: {e}")
# Calculate exponential backoff with some randomness (jitter)
delay = initial_delay * (backoff_factor ** (attempts - 1))
jitter = random.uniform(
0, 0.1 * delay
)
jitter = random.uniform(0, 0.1 * delay)
time.sleep(delay + jitter)

# The `method_` and `url_` arguments are suffixed with an underscore to
Expand All @@ -217,6 +215,8 @@ async def _static_request_async(

max_retries = 3
attempts = 0
initial_delay = 2
backoff_factor = 2
while attempts < max_retries:
try:
response = await requestor.request_async(method_, url_, params)
Expand All @@ -225,4 +225,7 @@ async def _static_request_async(
attempts += 1
if attempts >= max_retries:
raise RetryError(f"Failed after {max_retries} attempts: {e}")
time.sleep(2)
# Calculate exponential backoff with some randomness (jitter)
delay = initial_delay * (backoff_factor ** (attempts - 1))
jitter = random.uniform(0, 0.1 * delay)
time.sleep(delay + jitter)

0 comments on commit e782dcd

Please sign in to comment.