From 84f42795f0e050d47656690c0b20c1afaf9b6043 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 29 Jun 2018 11:11:38 +0200 Subject: [PATCH] Make sequential_updates=True the default in sync --- telethon/client/telegrambaseclient.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/telethon/client/telegrambaseclient.py b/telethon/client/telegrambaseclient.py index b93e1f37..02439a0f 100644 --- a/telethon/client/telegrambaseclient.py +++ b/telethon/client/telegrambaseclient.py @@ -93,15 +93,13 @@ class TelegramBaseClient(abc.ABC): times automatically if Telegram disconnects us or not. sequential_updates (`bool`, optional): - By default every incoming update will create a new task, so - you can handle several updates in parallel. Some scripts need - the order in which updates are processed to be sequential, and - this setting allows them to do so. + By default every incoming update will be processed under the + same thread (which means they're processed in a sequential + order). - If set to ``True``, incoming updates will be put in a queue - and processed sequentially. This means your event handlers - should *not* perform long-running operations since new - updates are put inside of an unbounded queue. + You can disable this behaviour by setting it to ``False`` + which will create a new thread per update. This gives more + concurrency. flood_sleep_threshold (`int` | `float`, optional): The threshold below which the library should automatically @@ -150,14 +148,13 @@ class TelegramBaseClient(abc.ABC): request_retries=5, connection_retries=5, auto_reconnect=True, - sequential_updates=False, + sequential_updates=True, flood_sleep_threshold=60, device_model=None, system_version=None, app_version=None, lang_code='en', - system_lang_code='en', - loop=None): + system_lang_code='en'): if not api_id or not api_hash: raise ValueError( "Your API ID or Hash cannot be empty or None. "