From 09f61c68c2fcf0c83c8e472d4ee3c0f4487f0dda Mon Sep 17 00:00:00 2001 From: Suzuki Kyosuke Date: Fri, 22 Jun 2018 14:44:27 +0900 Subject: [PATCH] fix: never call response body Close() --- dashboard.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dashboard.go b/dashboard.go index b98f808..2a0aedc 100644 --- a/dashboard.go +++ b/dashboard.go @@ -229,10 +229,10 @@ func watchForTrigger(command string) { continue } index = newIndex - defer resp.Body.Close() var kvps []*KVPair dec := json.NewDecoder(resp.Body) dec.Decode(&kvps) + resp.Body.Close() // find each current item of category currentItem := make(map[string]Item) @@ -350,13 +350,13 @@ func updateNodes() { continue } index = newIndex - defer resp.Body.Close() dec := json.NewDecoder(resp.Body) mutex.Lock() dec.Decode(&Nodes) log.Println("[info]", Nodes) mutex.Unlock() time.Sleep(1 * time.Second) + resp.Body.Close() } } @@ -372,12 +372,12 @@ func updateServices() { continue } index = newIndex - defer resp.Body.Close() dec := json.NewDecoder(resp.Body) mutex.Lock() dec.Decode(&Services) mutex.Unlock() time.Sleep(1 * time.Second) + resp.Body.Close() } }