I have a function that I want to call every minute for instance and my code look like this:
async def fun1():
print('fun1')
await asyncio.sleep(30)
async def fun2():
print('fun2')
await asyncio.sleep(10)
async def fun3():
print('fun3')
async def main():
global loop
loop.create_task(fun1())
loop.create_task(fun2())
while True:
await fun3()
await asyncio.sleep(1)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
but it does not print anything. I would like my function to be called every 10 seconds for instance. It looks like fun2 is waiting for fun1 to finish instead of triggering every 30 seconds and 10 seconds respectively... Any idea why pelase?