Skip to content

Commit 6fa6ca5

Browse files
authored
Merge pull request #485 from Megabytemb/async_retry_delay
fix: use asyncio.sleep for non-blocking delay in RetryHandler
2 parents ad7b928 + 93f409d commit 6fa6ca5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/http/httpx/kiota_http/middleware/retry_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import asyncio
12
import datetime
23
import random
34
import re
4-
import time
55
from email.utils import parsedate_to_datetime
66

77
from kiota_abstractions.request_option import RequestOption
@@ -95,7 +95,7 @@ async def send(self, request: httpx.Request, transport: httpx.AsyncBaseTransport
9595
# and status code
9696
should_retry = self.should_retry(request, current_options, response)
9797
if all([should_retry, retry_valid, delay < RetryHandlerOption.MAX_DELAY]):
98-
time.sleep(delay)
98+
await asyncio.sleep(delay)
9999
# increment the count for retries
100100
retry_count += 1
101101
request.headers.update({RETRY_ATTEMPT: f'{retry_count}'})

0 commit comments

Comments
 (0)