aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg/uniq/uniq.go
diff options
context:
space:
mode:
authorGravatar Zach Eddy <ZachEddy@users.noreply.github.com> 2018-08-21 08:52:25 -0700
committerGravatar Francois Tur <ftur@infoblox.com> 2018-08-21 11:52:25 -0400
commit8aa55c5ff2f30b2d4b4c5faad5e0a465648f9736 (patch)
treeb0d5675604368eacf794dbaad205936e0b222ef1 /plugin/pkg/uniq/uniq.go
parentb87ed01bb24e2c82b931b022dadeb4da3869c782 (diff)
downloadcoredns-8aa55c5ff2f30b2d4b4c5faad5e0a465648f9736.tar.gz
coredns-8aa55c5ff2f30b2d4b4c5faad5e0a465648f9736.tar.zst
coredns-8aa55c5ff2f30b2d4b4c5faad5e0a465648f9736.zip
Metrics listener fix (#2036)
* Create test to verify correct listener behavior * Create Unset function to remove todo items * Reset address for prometheus listener before restarting * Add inline documentation for Unset function * Make shutdownTimeout a constant and change to five seconds * Revert ForEach behavior in uniq package
Diffstat (limited to 'plugin/pkg/uniq/uniq.go')
-rw-r--r--plugin/pkg/uniq/uniq.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugin/pkg/uniq/uniq.go b/plugin/pkg/uniq/uniq.go
index 3e50d64b5..6dd74883d 100644
--- a/plugin/pkg/uniq/uniq.go
+++ b/plugin/pkg/uniq/uniq.go
@@ -24,6 +24,13 @@ func (u U) Set(key string, f func() error) {
u.u[key] = item{todo, f}
}
+// Unset removes the 'todo' associated with a key
+func (u U) Unset(key string) {
+ if _, ok := u.u[key]; ok {
+ delete(u.u, key)
+ }
+}
+
// SetTodo sets key to 'todo' again.
func (u U) SetTodo(key string) {
v, ok := u.u[key]