Add run_async parameter to ConversationHandler#2292
Add run_async parameter to ConversationHandler#2292Bibo-Joshi merged 7 commits intopython-telegram-bot:masterfrom zeshuaro:conv-handler-async-param
Conversation
There was a problem hiding this comment.
Thanks for your PR!
Looking at the changes, I was wondering if maybe it's a better idea to not override the setting of the handlers but only change it during handle_update, i.e. something along the lines
setting = handler.rus_async
handler.run_async = True if self.run_async else handler.run_async
handler.handle_updater(update)
handler.run_async = settingbut I'm not 100% sure if that could still have side effects if the same handler object is used in two places … Currently Dispatcher.process_update is calling handle_update() one after the other, even if internally they might call Dispatcher.run_async but if that's changed at some point and the above approach will be hard to debug. and maybe the use case for having the same handler object in multiple places is small enough to just go with overriding.
@Poolitzer do you have an opinion on this?
PS: JobQueue fails are obviously unrelated. Please apply this fix in your PR.
|
How about deep copying the handlers and with |
Mh, that's risky. What do we do if someone uses a custom handler with a |
Right, didn't know we can define a custom handler but that makes sense. Going back to what we have implemented in this PR. If a user sets |
Yes, my point is that that's rather unexpected. With proper documentation I think I'm okay with it but that's why I asked for pools opinion. BTW, before I forget: we started adding |
I do not. what would be the upside to your suggested solution? |
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
|
I pushed a little bit more doc nitpicking … Thank you for your contribution @zeshuaro ! Merging. |
* Add New Shortcuts to Chat (#2291) * Add shortcuts * Add a note * Add run_async Parameter to ConversationHandler (#2292) * Add run_async parameter * Update docstring * Update test to explicitly specify parameter * Fix test job queue * Add version added tag to docs * Update docstring Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com> * Doc nitpicking Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com> Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de> * Fix rendering in messageentity Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de> Co-authored-by: zeshuaro <joshuaystang@gmail.com> Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
run_asyncparameter toConversationHandlerrun_asyncis set toTrue, overrides all handlers in thisConversationHandlerwithrun_asyncequals toTrue