Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
There is no way to stop the auto-reconnect loop #201
Comments
|
@minidron Hi. This is normal behavior; the idea behind is to keep trying reconnecting indefinitely in order to ensure a client is always connected in case of temporary network issues. With the DisconnectHandler you are able to change a proxy (usually cycle through a list of them) on disconnections. Pyrogram will always try to connect up to 3 times each loop before calling your disconnect handler callback, and then continues. It now occurs to me that there's no way to gracefully stop a client, if we wanted to, in a case like yours. I'm thinking about adding something like client.stop_reconnection() to be called inside a DisconnectHandler which will signal Pyrogram to stop trying reconnecting and finally freeing app.start(). What do you think? If you have any other ideas feel free to suggest. |
|
@delivrance Hi. Thanks. I thinking client.stop_reconnection() is good idea. Maybe default behavior without reconnect and add client.reconnect() ? This is more predictable behavior. |


If set wrong proxy settings or proxy server is down, app.start() stuck in a loop.
pyrogram/session/session.py
TimeoutError not break while.
Maybe it should be like this?