Save the session file less often

This commit is contained in:
Lonami Exo
2018-06-24 12:21:58 +02:00
parent 026c0c4f9d
commit d4479a0a4e
2 changed files with 9 additions and 4 deletions

View File

@@ -215,6 +215,12 @@ class UpdateMethods(UserMethods):
# Just send them periodically.
self._sender.send(functions.PingRequest(rnd()))
# Entities and cached files are not saved when they are
# inserted because this is a rather expensive operation
# (default's sqlite3 takes ~0.1s to commit changes). Do
# it every minute instead. No-op if there's nothing new.
self.session.save()
# We need to send some content-related request at least hourly
# for Telegram to keep delivering updates, otherwise they will
# just stop even if we're connected. Do so every 30 minutes.