Simplify Limiter implementation

This commit is contained in:
Joscha 2021-04-29 16:37:42 +02:00
parent 20a24dbcbf
commit 0096d83387

View File

@ -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()