-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Improve timeouts handling in conversation handlers #2417
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
Conversation
Signed-off-by: starry69 <starry369126@outlook.com>
Signed-off-by: starry69 <starry369126@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the comment I left, I'm still missing a few things:
-
We should add a note that
timeout
withrun_async
may fail, if the promise takes longer than the timeout (as described in Improve timeouts handling in conversation handlers #2417) -
We need a test that makes sure the timeout handlers are not triggered, if the promise resolves to
CH.END
. Ideally, we'd also have a test that makes sure that stuff still works if the promise raises an exception -
Timeout of child conversations needs to be detected by parent conversations somehow. If we can't get that to work, the added warning needs to be reformulated and the limitation needs to be documented. picking up my idea from off-line to have
check_update
check if the child has timed out in the meantime: that's not stright forward, as the childs state is thenNone
and also the child may be used in multiple parent conversations (having the same CH instance as child in multiple parents is surely somewhat crazy but we can't prevent that either …).TBH while typing this I feel like it may just not be worth the effort and we might just want to document the limitation for now and revisit only if someone complains …
PS: most of the test fails are due to #2409 …
Signed-off-by: starry69 <starry369126@outlook.com>
Signed-off-by: starry69 <starry369126@outlook.com>
Signed-off-by: starry69 <starry369126@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My third bullet point remains to be resolved. Do you have a preference on that?
Test failures: Seems like TG doesn't like our test bots anymore … I had problems with the fallback bots on local tests in the last time.
Imo we should leave it for now as you said, and just add a note in documentation that: using timeouts with nested conversation may cause troubles. TBH I've never seen anyone complaining about timeouts in nested conversation triggering incorrectly, even when it was bugged, which tells that users rarely use timeouts in nested conversation, besides, now we also have a warning in place so ig we should be fine... |
All right. I'd just to reformulate the note & warning in this case, to be more explicit. E.g. something like
for both |
Signed-off-by: starry69 <starry369126@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll wait with merging, though, let's first see if we can get the tests to work again …
Yep sure 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code changes look good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ!
tests now look good, but coverage is not happy. @starry69 can you check why line 647 in CH is not covered? |
f7895d1
to
a2f9b91
Compare
Signed-off-by: starry69 <starry369126@outlook.com>
Fixed |
Signed-off-by: starry69 <starry369126@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Looks like you edited README.rst or README_RAW.rst. I'm just a friendly reminder to apply relevant changes to both of those files :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Looks like you edited the (dev) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the pre-commit hook versions in sync with the dev requirements and the additional dependencies for the hooks in sync with the requirements :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for re-working :)
Overall looks good, I left some remarks
Signed-off-by: starry69 <starry369126@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a look at the updates and left some minor comments. Codecov complains that the added except
in Promise
isn't hit …
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilent Code it's wonderful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience @starry69 ! Almost done, just some minor nit picking left :)
Signed-off-by: starry69 <starry369126@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy now :) @Poolitzer do you want to review again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good QoL change!
|
||
Note: | ||
Using `conversation_timeout` with nested conversations is currently not | ||
supported. You can still try to use it, but it will likely behave differently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supported. You can still try to use it, but it will likely behave differently | |
supported. You can try to use it, but it will likely behave differently |
if isinstance(handler, self.__class__): | ||
warnings.warn( | ||
"Using `conversation_timeout` with nested conversations is currently not " | ||
"supported. You can still try to use it, but it will likely behave " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"supported. You can still try to use it, but it will likely behave " | |
"supported. You can try to use it, but it will likely behave " |
Closes #2407