예제 #1
0
파일: spider.py 프로젝트: bminossi/distbot
 async def _close_page(self, page: Page) -> None:
     logger.info(f"Removing page: {page}")
     if page in self.idle_page_q._queue:
         # remove page from idle queue.
         self.idle_page_q._queue.remove(page)
     del self.pages[page]
     try:
         # wait for page to close.
         await asyncio.wait_for(page.close(), timeout=2)
     except asyncio.TimeoutError:
         logger.warning(f"Page {page} could not be properly closed.")
예제 #2
0
 async def close_page(self, page: Page) -> None:
     """Attempt to close a page."""
     try:
         await asyncio.wait_for(page.close(), timeout=2)
     except Exception:
         self.logger.warning(f"Page {page} could not be properly closed.")