mirror of
https://github.com/Garmelon/PFERD.git
synced 2025-08-14 03:22:28 +02:00
Simplify Limiter implementation
This commit is contained in:
@@ -9,8 +9,5 @@ class Limiter:
|
|||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def limit(self) -> AsyncIterator[None]:
|
async def limit(self) -> AsyncIterator[None]:
|
||||||
await self._semaphore.acquire()
|
async with self._semaphore:
|
||||||
try:
|
|
||||||
yield
|
yield
|
||||||
finally:
|
|
||||||
self._semaphore.release()
|
|
||||||
|
Reference in New Issue
Block a user