telebot
telebot copied to clipboard
Add a socketTimeout option to timeout http requests
Add an option named socketTimeout for polling to set a socket read timeout for http requests to telegram. The default value is set to 30 seconds. Otherwise there is no socket read timeout and connection can hang indefinitely on some systems.
Well I just realized looking at the telegram API that the getUpdates is a long polling request, so the default value is not good and should probably be 0 ( no timeout). However I still think that it is more reliable to have the connection timeout. Also when the socket timeout value is set, it should be checked to be greater than the getUpdates timeout.