coredns/plugin/cancel
Yong Tang f8bba51f84
Update Caddy to 1.0.1, and update import path (#2961)
* Update Caddy to 1.0.1, and update import path

This fix updates caddy to 1.0.1 and also
updates the import path to github.com/caddyserver/caddy

This fix fixes 2959

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Also update plugin.cfg

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Update and bump zplugin.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-07-03 09:04:47 +08:00
..
cancel.go Update Caddy to 1.0.1, and update import path (#2961) 2019-07-03 09:04:47 +08:00
cancel_test.go plugin/cancel: add context cancelation plugin (#2711) 2019-03-29 19:40:23 +00:00
OWNERS plugin/cancel: add context cancelation plugin (#2711) 2019-03-29 19:40:23 +00:00
README.md plugin/cancel: add context cancelation plugin (#2711) 2019-03-29 19:40:23 +00: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 - a plugin that 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 is 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

. {
    cancel
    whoami
}

Or with a custom timeout:

. {
    cancel 1s
    whoami
}

Also See

The Go documentation for the context package.