fangwenxue
V2EX  ›  问与答

Python async_timeout 问题

  •  
  •   fangwenxue · Jul 16, 2021 · 1133 views
    This topic created in 1828 days ago, the information mentioned may be changed or developed.
        async def async_timeout_run(self, callback):
            try:
                async with async_timeout.timeout(60):
                    await getattr(self, callback)()
            except asyncio.TimeoutError as t:
                self.logger.warning(t)
    
    
    await self.async_timeout_run('delete_api')
    
    • delete_api 这个方法执行超过 60 秒没有抛异常,一直在执行
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2618 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:59 · PVG 18:59 · LAX 03:59 · JFK 06:59
    ♥ Do have faith in what you're doing.