* Generate html for plugins Signed-off-by: Miek Gieben <miek@miek.nl> * Release 1.6.4 Signed-off-by: Miek Gieben <miek@miek.nl>
1.1 KiB
+++ title = "cancel" description = "cancel cancels a request's context after 5001 milliseconds." weight = 8 tags = [ "plugin", "cancel" ] categories = [ "plugin" ] date = "2019-09-27T10:37:57.663365" +++
Description
The cancel plugin creates a canceling context for each request. It adds a timeout that gets triggered after 5001 milliseconds.
The 5001 number was chosen because the default timeout for DNS clients is 5 seconds, after that they give up.
A plugin interested in the cancellation status should call plugin.Done() on the context. If the
context was canceled due to a timeout the plugin should not write anything back to the client and
return a value indicating CoreDNS should not either; a zero return value should suffice for that.
cancel [TIMEOUT]
- TIMEOUT allows setting a custom timeout. The default timeout is 5001 milliseconds (
5001 ms)
Examples
example.org {
cancel
whoami
}
Or with a custom timeout:
example.org {
cancel 1s
whoami
}
Also See
The Go documentation for the context package.