Ensure Safe Handler Looping in Application.process_update/error#4802
Ensure Safe Handler Looping in Application.process_update/error#4802Bibo-Joshi merged 11 commits intomasterfrom
Application.process_update/error#4802Conversation
aelkheir
left a comment
There was a problem hiding this comment.
LGTM
At first I thought the exception being raised is reasonable, because i'm not sure of a use case where one would need to add handlers dynamically.
And the fact that it was not working, means that PTB users are also just discovering these use cases.
Maybe bot builders (?) where users of the bot add custom command/messages handers base on their input, also then how can the callback part be dynamic.
But that's for users to answer. We can have it.
Just one thought considering how this should work, for now if one dynamically adds a handler in a different group than the one currently selected, it will not be considered for the same update currently being processed, as the list of handlers was copied long before.
would that be a normal/abnormal behavior?
At least I'd say since we're offering add/remove_handler at runtime, it should not throw an exception, independently on how exactly that's achieved :D
Yes, I'd say that's expected. I think there are a few different options one could choosev
Also I've realized that we need the same logic in where we loop over the handler list within the group .. |
* cover also process-error * cover non-critical list-loops * document behavior as implementation detail
Application.process_updateApplication.process_update/error
|
Explanation of additional changes:
|
👍
the hint+warning are sensible imo |
|
mh, apparently some test case is in a deadlock now 😵💫 will have to investigate. not today, though |
|
hanging tests apparently were already fixed by 2373596 🕺 |
Co-authored-by: Abdelrahman Elkheir <90580077+aelkheir@users.noreply.github.com>
Based on user input https://t.me/pythontelegrambotgroup/779167
Closes #4803
Details