Faltou adicionar um return após enviar para o vip
import asyncio
users = [
{"name": "Ana", "vip": True, "silence": False},
{"name": "João", "vip": False, "silence": False},
{"name": "Carla", "vip": False, "silence": True},
]
async def notify_user(user):
if user["silence"]:
print(f"User {user['name']} is silenced. Skipping notification.")
return
if user["vip"]:
print(f"Sending VIP notification to {user['name']}...")
return
print(f"Sending normal notification to {user['name']}...")
async def main():
print("Starting notifications...")
tasks = [asyncio.create_task(notify_user(user)) for user in users]
await asyncio.gather(*tasks)
print("All notifications sent!")
asyncio.run(main())