coredns/plugin/cancel
Miek Gieben c2e4f2f1ab
docs: move Also See to See Also (#4245)
sed -i 's/Also See/See Also/' plugin/**/README.md

Some plugins did already use 'See Also', so it's all consistent now.

Fixes: #4196

Signed-off-by: Miek Gieben <miek@miek.nl>
2020-10-28 10:56:35 -07:00
..
cancel.go For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02:00
cancel_test.go go report card fixes (#3182) 2019-08-24 18:14:25 +00:00
README.md docs: move Also See to See Also (#4245) 2020-10-28 10:56:35 -07:00
setup_test.go For caddy v1 in our org (#4018) 2020-09-24 18:14:41 +02: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.

Syntax

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
}

See Also

The Go documentation for the context package.