Skip to content

Commit

Permalink
Add option to avoid connecting users on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Half-Shot committed Nov 19, 2021
1 parent 24d9dad commit 947ce81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mautrix_telegram/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,15 @@ def prepare_bridge(self) -> None:
init_formatter(context)
init_portal(context)
self.add_startup_actions(init_puppet(context))
self.add_startup_actions(init_user(context))
init_users_task = init_user(context)

if self.config["telegram.connection.block_startup"] is not False:
self.log.info("Connecting users to Telegram before starting up")
self.add_startup_actions(init_users_task)
else:
self.log.info("Connecting users to Telegram in the background")
self.loop.create_task(init_users_task)

if self.bot:
self.add_startup_actions(self.bot.start())
if self.config["bridge.resend_bridge_info"]:
Expand Down
1 change: 1 addition & 0 deletions mautrix_telegram/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def do_update(self, helper: ConfigUpdateHelper) -> None:
copy("telegram.connection.retry_delay")
copy("telegram.connection.flood_sleep_threshold")
copy("telegram.connection.request_retries")
copy("telegram.connection.block_startup")

copy("telegram.device_info.device_model")
copy("telegram.device_info.system_version")
Expand Down

0 comments on commit 947ce81

Please sign in to comment.