V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
fangwenxue
V2EX  ›  问与答

Python async_timeout 问题

  •  
  •   fangwenxue · Jul 16, 2021 · 935 views
    This topic created in 1747 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   ·   1007 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 19:19 · PVG 03:19 · LAX 12:19 · JFK 15:19
    ♥ Do have faith in what you're doing.