Is there any way to reconnect after getting StreamTerminatedError?
max_retries = 5
for retries in range(max_retries):
try:
await stream.send_message(...)
break
except StreamTerminatedError as e:
if (retries + 1) == max_retries:
raise e
# Reconnect here
await asyncio.sleep(10)
I wanted to reconnect to the channel and try sending a message again without creating another context or whole stream connection.
Are there any tricks? I just wanted to ensure about sending a specific message.
Is there any way to reconnect after getting StreamTerminatedError?
I wanted to reconnect to the channel and try sending a message again without creating another context or whole stream connection. Are there any tricks? I just wanted to ensure about sending a specific message.