From 896c828bb5327555a17d9053b5f5d32b96e40863 Mon Sep 17 00:00:00 2001 From: jessicagreben Date: Mon, 29 Mar 2021 06:45:12 -0700 Subject: [PATCH] close writer after flush Signed-off-by: jessicagreben --- cmd/promtool/rules.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/promtool/rules.go b/cmd/promtool/rules.go index 90441a4239..e73b48241c 100644 --- a/cmd/promtool/rules.go +++ b/cmd/promtool/rules.go @@ -164,12 +164,12 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName default: return errors.New(fmt.Sprintf("rule result is wrong type %s", val.Type().String())) } - err = tsdb_errors.NewMulti(err, w.Close()).Err() - closed = true if err := app.flushAndCommit(ctx); err != nil { return errors.Wrap(err, "flush and commit") } + err = tsdb_errors.NewMulti(err, w.Close()).Err() + closed = true } return err