Skip to content

Commit b205751

Browse files
committed
change default value for poll_interval to 0
1 parent c4f13bd commit b205751

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

telegram/updater.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ def __init__(self, token, base_url=None, workers=4):
8282
self.is_idle = False
8383
self.httpd = None
8484

85-
def start_polling(self, poll_interval=1.0, timeout=10, network_delay=2):
85+
def start_polling(self, poll_interval=0.0, timeout=10, network_delay=2):
8686
"""
8787
Starts polling updates from Telegram.
8888
8989
Args:
9090
poll_interval (Optional[float]): Time to wait between polling
91-
updates from Telegram in seconds. Default is 1.0
91+
updates from Telegram in seconds. Default is 0.0
9292
timeout (Optional[float]): Passed to Bot.getUpdates
9393
network_delay (Optional[float]): Passed to Bot.getUpdates
9494
@@ -192,9 +192,11 @@ def _start_polling(self, poll_interval, timeout, network_delay):
192192
except URLError as e:
193193
self.logger.error("Error while getting Updates: %s" % e)
194194
# increase waiting times on subsequent errors up to 30secs
195-
if current_interval < 30:
195+
if current_interval == 0:
196+
current_interval = 1
197+
elif current_interval < 30:
196198
current_interval += current_interval / 2
197-
if current_interval > 30:
199+
elif current_interval > 30:
198200
current_interval = 30
199201

200202
self.logger.info('Updater thread stopped')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy