Use conductor via context manager

This commit is contained in:
Joscha
2021-04-29 14:23:28 +02:00
parent 6431a3fb3d
commit 2e85d26b6b
2 changed files with 26 additions and 22 deletions

View File

@ -63,11 +63,8 @@ class Crawler(ABC):
return self.progress_bar(desc, total=size)
async def run(self) -> None:
await self._conductor.start()
try:
async with self._conductor:
await self.crawl()
finally:
await self._conductor.stop()
@abstractmethod
async def crawl(self) -> None: