made async
This commit is contained in:
parent
90e9b9bb05
commit
34d6aa5a36
@ -44,7 +44,7 @@ class MinSizePerRequestError(Exception):
|
|||||||
|
|
||||||
|
|
||||||
@api.get('/')
|
@api.get('/')
|
||||||
def test_data(api_key: str, request: Request, size: str) -> StreamingResponse:
|
async def test_data(api_key: str, request: Request, size: str) -> StreamingResponse:
|
||||||
try:
|
try:
|
||||||
if api_key not in AUTHORIZED_KEYS:
|
if api_key not in AUTHORIZED_KEYS:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
@ -20,7 +20,7 @@ def convert_to_bytes(size: int | str) -> int:
|
|||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
|
|
||||||
def generate_data(size: int, buffer_size: int = 4 * 1024) -> bytes:
|
async def generate_data(size: int, buffer_size: int = 4 * 1024) -> bytes:
|
||||||
size_left = size
|
size_left = size
|
||||||
|
|
||||||
while size_left > buffer_size:
|
while size_left > buffer_size:
|
||||||
|
Loading…
Reference in New Issue
Block a user