plugin/health : rework overloaded goroutine to support graceful shutdown (#5244)

Signed-off-by: Ondřej Benkovský <ondrej.benkovsky@jamf.com>
This commit is contained in:
Ondřej Benkovský
2022-04-13 19:09:03 +02:00
committed by GitHub
parent 068af64b19
commit a929b0b1ec
5 changed files with 63 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ import (
)
func TestHealth(t *testing.T) {
h := &health{Addr: ":0", stop: make(chan bool)}
h := &health{Addr: ":0"}
if err := h.OnStartup(); err != nil {
t.Fatalf("Unable to startup the health server: %v", err)
@@ -37,7 +37,7 @@ func TestHealth(t *testing.T) {
}
func TestHealthLameduck(t *testing.T) {
h := &health{Addr: ":0", stop: make(chan bool), lameduck: 250 * time.Millisecond}
h := &health{Addr: ":0", lameduck: 250 * time.Millisecond}
if err := h.OnStartup(); err != nil {
t.Fatalf("Unable to startup the health server: %v", err)