From a00a9da6c4d4f2dac1b9ba5f2397d1fba9b7a8e9 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Fri, 22 Oct 2021 15:56:01 -0700 Subject: [PATCH] reset buffer after use (#4279) Signed-off-by: Brian Downs --- pkg/cluster/bootstrap.go | 2 +- pkg/cluster/https.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cluster/bootstrap.go b/pkg/cluster/bootstrap.go index c579842647dd..76cc290cab70 100644 --- a/pkg/cluster/bootstrap.go +++ b/pkg/cluster/bootstrap.go @@ -243,7 +243,6 @@ RETRY: } files := make(bootstrap.PathsDataformat) - if err := json.NewDecoder(buf).Decode(&files); err != nil { // This will fail if data is being pulled from old an cluster since // older clusters used a map[string][]byte for the data structure. @@ -254,6 +253,7 @@ RETRY: return err } } + buf.Seek(0, 0) type update struct { db, disk, conflict bool diff --git a/pkg/cluster/https.go b/pkg/cluster/https.go index 8f83e148e9a4..3b6588f63e51 100644 --- a/pkg/cluster/https.go +++ b/pkg/cluster/https.go @@ -79,7 +79,9 @@ func (c *Cluster) initClusterAndHTTPS(ctx context.Context) error { // Create a HTTP server with the registered request handlers, using logrus for logging server := http.Server{ - Handler: handler} + Handler: handler, + } + if logrus.IsLevelEnabled(logrus.DebugLevel) { server.ErrorLog = log.New(logrus.StandardLogger().Writer(), "Cluster-Http-Server ", log.LstdFlags) } else {