I have several tasks (async def), one of them has an eternal loop, the second has another loop that processes requests. But when trying to create a new task where Google PubSub will receive all notifications - Pub/Sub stops other tasks from running and loops how to make multiple tasks in asyncio, but so that they work independently of each other.
P.S - If you bring a basic example, this is how to run two loops, the second one will not work simultaneously with the first one (I need to solve this, but already in asyncio)
async def coursework_handler():
def handler(msg):
data = json.loads(msg.data.decode("utf-8"))
if data["eventType"] == "MODIFIED":
print(data)
stream = subscriber.subscribe(sub_path, callback=handler)
try:
stream.result()
except:
stream.cancel()
stream.result()