-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[FEATURE/DISCUSSION]: Allow fine tuning of persistence setup #2524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Milestone
Comments
I like both of these suggestions. Since we redesign a lot for 14 anyway, and the resulting maintenance after doing it once shouldn't be too bad, |
Got started on the first part of this in the https://github.com/python-telegram-bot/python-telegram-bot/tree/customize-replace-insert-bot branch. But we're currently re-evaluating if we want to proceed this. second part may be independent. |
closed by #2893 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There are two places in the current persistence setup where I think we can offer more customization for advanced users. All of this are just first ideas and up for discussion. If the dev team doesn't like the (use case value)/(maintenance workload) ratio, I'd be fine with not doing this.
Edit: We're dropping
insert/replace_data
see Drop BasePersistence.insert/replace_bot #2882 .Original comment:
We currently pass all data that goes through the persistence setup through
replace/insert_bot
. While this is the safest way to make sure noBot
instance gets serialized, it can also introduce some overhead which could get noticable when you have large, nested data structures in yourchat/bot/user_data
or are handling many updates. Adanced users will know where in their data they have bot instances that should get replaced. So we could offer settings likereplace_bots_in_chat/bot/user_data
(defaulting to True) and only callreplace/insert_data
when necessary.One should note that we'd have to re-indroduce deepcopy into the built-in persistence classes (depending on the
replace_bots_in_*
settings, that is). See Customize context #2262 (comment)Adjust calling of update_persistence #2285 already made an effort to reduce the calls of
Dispatcher.update_persistence
. Still, updating after every update (or even handler call in case you're usingrun_async
) might be unecessary, especially when you're getting updates frequently. Similarly toPicklePersistence.on_flush
which allows users to control how oftenPP
writes to file, we would add a flag tellingDispatcher
to never automatically callDispatcher.update_persistence
at runtime (only on shutdown). Then users can callDispatcher.update_persistence
manually to their liking.The text was updated successfully, but these errors were encountered: