use default value for return exceptions (#246)
This commit is contained in:
parent
7f94b0c648
commit
fcff4ca67c
1 changed files with 2 additions and 7 deletions
|
|
@ -86,16 +86,11 @@ def normalize_l2(embedding: list[float]) -> list[float]:
|
||||||
|
|
||||||
|
|
||||||
# Use this instead of asyncio.gather() to bound coroutines
|
# Use this instead of asyncio.gather() to bound coroutines
|
||||||
async def semaphore_gather(
|
async def semaphore_gather(*coroutines: Coroutine, max_coroutines: int = SEMAPHORE_LIMIT):
|
||||||
*coroutines: Coroutine, max_coroutines: int = SEMAPHORE_LIMIT, return_exceptions=True
|
|
||||||
):
|
|
||||||
semaphore = asyncio.Semaphore(max_coroutines)
|
semaphore = asyncio.Semaphore(max_coroutines)
|
||||||
|
|
||||||
async def _wrap_coroutine(coroutine):
|
async def _wrap_coroutine(coroutine):
|
||||||
async with semaphore:
|
async with semaphore:
|
||||||
return await coroutine
|
return await coroutine
|
||||||
|
|
||||||
return await asyncio.gather(
|
return await asyncio.gather(*(_wrap_coroutine(coroutine) for coroutine in coroutines))
|
||||||
*(_wrap_coroutine(coroutine) for coroutine in coroutines),
|
|
||||||
return_exceptions=return_exceptions,
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue