-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
plugin/cancel: add context cancelation plugin #2711
Conversation
Per review comments on #2704, move this into a plugin that gets called. Add the most minimal plugin, tests and documenation. Signed-off-by: Miek Gieben <miek@miek.nl>
Thank you for your contribution. I've just checked the OWNERS files to find a suitable reviewer. This search was successful and I've asked stp-ip (via If you have questions or suggestions for this bot, please file an issue against the miekg/dreck repository. The bot understands the commands that are listed here. |
The *cancel* plugin creates a canceling context for each request. It adds a timeout that gets | ||
triggered after 5001 milliseconds. | ||
|
||
The 5001 number is chosen because the default timeout for DNS clients is 5 seconds, after that they |
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 know you like to avoid knobs, but I can see use cases for setting this even lower so making it customizable makes sense to me.
plugin/cancel/README.md
Outdated
The 5001 number is chosen because the default timeout for DNS clients is 5 seconds, after that they | ||
give up. | ||
|
||
A pluging interested in the cancelation status should call `plugin.Done()` on the context. If the |
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.
Should this be plumbed through the higher level plugin.NextOrFailure? Or just a best practice, in which case we should update other plugins to use it.
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] plugin/cancel..." ]
I know you like to avoid knobs, but I can see use cases for setting this even lower so making it customizable makes sense to me.
I have no problem with that. The default can be explained and rationalized, if
you want something else that's fine.
/Miek
…--
Miek Gieben
|
[ Quoting <notifications@github.com> in "Re: [coredns/coredns] plugin/cancel..." ]
+## Description
+
+The *cancel* plugin creates a canceling context for each request. It adds a timeout that gets
+triggered after 5001 milliseconds.
+
+The 5001 number is chosen because the default timeout for DNS clients is 5 seconds, after that they
+give up.
+
+A pluging interested in the cancelation status should call `plugin.Done()` on the context. If the
Should this be plumbed through the higher level plugin.NextOrFailure? Or just a best practice, in which case we should update other plugins to use it.
That pretty hard to do (and make genericly usable). Also most plugins won't need
this as they access something in memory (e.g. cache). So first, and foremost I
see this being used in *forward* to drop requests.
|
review feedback: add option to set custom timeout. Signed-off-by: Miek Gieben <miek@miek.nl>
Codecov Report
@@ Coverage Diff @@
## master #2711 +/- ##
==========================================
+ Coverage 55.1% 55.14% +0.04%
==========================================
Files 198 201 +3
Lines 10070 10151 +81
==========================================
+ Hits 5549 5598 +49
- Misses 4106 4134 +28
- Partials 415 419 +4
Continue to review full report at Codecov.
|
lgtm, but waiting for @johnbelamaric to lgtm |
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.
Just fix these two typos in the docs and it's ready to go.
plugin/cancel/README.md
Outdated
The 5001 number is chosen because the default timeout for DNS clients is 5 seconds, after that they | ||
give up. | ||
|
||
A pluging interested in the cancelation status should call `plugin.Done()` on the context. If the |
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.
s/pluging/plugin/
plugin/cancel/README.md
Outdated
cancel [TIMEOUT] | ||
~~~ | ||
|
||
* **TIMEOUT** allowss setting a custom timeout. The default timeout is 5001 milliseconds (`5001 ms`) |
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.
s/allowss/allows/
done.
I'll hold off on merging this to see if it actually makes sense to merge.
I would also be helpful to get the kernel timestamp for the received message so
we can adjust the timeout accordingly.
|
/lgtm |
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.
LGTM by johnbelamaric
let's see if this works. |
* plugin/cancel: add context cancelation plugin Per review comments on coredns#2704, move this into a plugin that gets called. Add the most minimal plugin, tests and documenation. Signed-off-by: Miek Gieben <miek@miek.nl> * plugin/cache: add timeout option review feedback: add option to set custom timeout. Signed-off-by: Miek Gieben <miek@miek.nl> * spelling Signed-off-by: Miek Gieben <miek@miek.nl>
* plugin/cancel: add context cancelation plugin Per review comments on coredns#2704, move this into a plugin that gets called. Add the most minimal plugin, tests and documenation. Signed-off-by: Miek Gieben <miek@miek.nl> * plugin/cache: add timeout option review feedback: add option to set custom timeout. Signed-off-by: Miek Gieben <miek@miek.nl> * spelling Signed-off-by: Miek Gieben <miek@miek.nl>
Per review comments on #2704, move this into a plugin that gets called.
Add the most minimal plugin, tests and documenation.