telebot icon indicating copy to clipboard operation
telebot copied to clipboard

Add a socketTimeout option to timeout http requests

Open lucdew opened this issue 6 years ago • 1 comments

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.

lucdew avatar Apr 14 '18 15:04 lucdew

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.

lucdew avatar Apr 16 '18 18:04 lucdew