Generation: Explicitly release semaphore on disconnect
This prevents any lockups when querying another request. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
2025a1c857
commit
42c0dbe795
2 changed files with 12 additions and 1 deletions
|
|
@ -8,6 +8,10 @@ from typing import AsyncGenerator, Generator, Union
|
|||
generate_semaphore = asyncio.Semaphore(1)
|
||||
|
||||
|
||||
def release_semaphore():
|
||||
generate_semaphore.release()
|
||||
|
||||
|
||||
async def generate_with_semaphore(generator: Union[AsyncGenerator, Generator]):
|
||||
"""Generate with a semaphore."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue