Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion telebot/async_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def __init__(self, token: str, parse_mode: Optional[str]=None, offset: Optional[
self.middlewares = []

self._user = None # set during polling
self._background_tasks = set()

if validate_token:
util.validate_token(self.token)
Expand Down Expand Up @@ -453,7 +454,9 @@ async def _process_polling(self, non_stop: bool=False, interval: int=0, timeout:
if updates:
self.offset = updates[-1].update_id + 1
# noinspection PyAsyncCall
asyncio.create_task(self.process_new_updates(updates)) # Seperate task for processing updates
task = asyncio.create_task(self.process_new_updates(updates))
self._background_tasks.add(task)
task.add_done_callback(self._background_tasks.discard)
Comment on lines +457 to +459
Comment on lines +457 to +459
if interval: await asyncio.sleep(interval)
error_interval = 0.25 # drop error_interval if no errors

Expand Down
Loading