From 90f9fe584c5b93aaed6c52c1fc67d60dd01119a4 Mon Sep 17 00:00:00 2001 From: "dan.markhasin" Date: Mon, 7 Jun 2021 23:05:43 +0300 Subject: [PATCH] set default execution period to avoid panic --- options.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/options.go b/options.go index 9014cd2..815c980 100644 --- a/options.go +++ b/options.go @@ -37,7 +37,11 @@ func WithHealthListeners(listener ...HealthListener) HealthOption { // WithDefaults sets all the Health object settings. It's not required to use this as no options is always default // This is a simple placeholder for any future defaults func WithDefaults() HealthOption { - return healthOptionFunc(func(h *health) {}) + return healthOptionFunc(func(h *health) { + if h.defaultExecutionPeriod == 0 { + h.defaultExecutionPeriod = 1 * time.Minute + } + }) } // CheckOption configures a health check using the functional options paradigm