예제 #1
0
 async def worker():
     with timeout(loop, 1):
         try:
             await asyncio.sleep(2)
         except asyncio.CancelledError:
             cleanup.set()
             raise
예제 #2
0
 async def worker():
     with timeout(loop, 1):
         try:
             await asyncio.sleep(2)
         except asyncio.CancelledError:
             # Swallow the exception
             pass
     ignored.set()
예제 #3
0
 async def worker():
     with timeout(loop, 2):
         raise Exception('inner')
예제 #4
0
 async def worker():
     with timeout(loop, 1):
         await asyncio.sleep(0.5)