coredns/plugin/cancel
Miek Gieben 24176a97e6
Move to CODEOWNERS (#3489)
* Move to CODEOWNERS

No change in who own what; just a move to CODEOWNERS. This allows
dreck cleanups.

Added .dreck.yaml for alias and exec.

Fixes: #3486

Signed-off-by: Miek Gieben <miek@miek.nl>

* stickler bot

Signed-off-by: Miek Gieben <miek@miek.nl>

* sort the file

Signed-off-by: Miek Gieben <miek@miek.nl>
2019-11-29 13:17:05 +00:00
..
cancel.go Run gostaticheck (#3325) 2019-10-01 07:41:29 +01:00
cancel_test.go go report card fixes (#3182) 2019-08-24 18:14:25 +00:00
README.md update doc to not use the root zone for everything (#3288) 2019-09-19 06:17:53 -07:00
setup_test.go Update Caddy to 1.0.1, and update import path (#2961) 2019-07-03 09:04:47 +08:00

cancel

Name

cancel - cancels a request's context after 5001 milliseconds.

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.