From 0096d83387a75d7367e3fc42cfb4a58a1c5191f4 Mon Sep 17 00:00:00 2001 From: Joscha Date: Thu, 29 Apr 2021 16:37:42 +0200 Subject: [PATCH] Simplify Limiter implementation --- PFERD/limiter.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/PFERD/limiter.py b/PFERD/limiter.py index ff91d57..ae72fe6 100644 --- a/PFERD/limiter.py +++ b/PFERD/limiter.py @@ -9,8 +9,5 @@ class Limiter: @asynccontextmanager async def limit(self) -> AsyncIterator[None]: - await self._semaphore.acquire() - try: + async with self._semaphore: yield - finally: - self._semaphore.release()