We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a551fe commit fb60e48Copy full SHA for fb60e48
mineru/cli/fast_api.py
@@ -28,13 +28,17 @@
28
# 并发控制依赖函数
29
async def limit_concurrency():
30
if _request_semaphore is not None:
31
- if _request_semaphore.locked():
+ try:
32
+ await asyncio.wait_for(_request_semaphore.acquire(), timeout=0.0)
33
+ except asyncio.TimeoutError:
34
raise HTTPException(
35
status_code=503,
36
detail="Server is at maximum capacity. Please try again later."
37
)
- async with _request_semaphore:
38
39
yield
40
+ finally:
41
+ _request_semaphore.release()
42
else:
43
44
0 commit comments