From 2af2721b4d47b4be85d784210a0fda3ccb44f233 Mon Sep 17 00:00:00 2001 From: fangchengjin Date: Wed, 27 Oct 2021 16:40:20 +0800 Subject: [PATCH] fix panic when close falcon connection --- utils/FalconWriter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/FalconWriter.go b/utils/FalconWriter.go index f1d7e4f..36257b0 100644 --- a/utils/FalconWriter.go +++ b/utils/FalconWriter.go @@ -58,13 +58,13 @@ func (f *FalconWriter) PushToFalcon(ms []*FalconMetric) error { } bodyReader := bytes.NewBuffer(mb) resp, err := http.Post(f.falconUrl, "application/json", bodyReader) - defer resp.Body.Close() if err != nil { f.log.Errorf("Post data to falcon failed: %s", err.Error()) return err } + defer resp.Body.Close() return nil }