From 81f16062429063028d59837780523cff2bc25c11 Mon Sep 17 00:00:00 2001 From: Samir Patel <48686912+54mir@users.noreply.github.com> Date: Tue, 1 Jun 2021 20:47:53 -0500 Subject: [PATCH] poll places in indexDetails to check for closing --- txfactory.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/txfactory.go b/txfactory.go index 01b000b87..482b90f85 100644 --- a/txfactory.go +++ b/txfactory.go @@ -572,7 +572,7 @@ func (f *TxFactory) DumpAll() { // IndexUsageDetails computes the sum of filesizes used by the node, broken down // by index, field, fragments and keys. -func (f *TxFactory) IndexUsageDetails() (map[string]IndexUsage, uint64, error) { +func (f *TxFactory) IndexUsageDetails(isClosing func() bool) (map[string]IndexUsage, uint64, error) { indexUsage := make(map[string]IndexUsage) holderPath, err := expandDirName(f.holder.path) if err != nil { @@ -612,6 +612,9 @@ func (f *TxFactory) IndexUsageDetails() (map[string]IndexUsage, uint64, error) { fragmentUsage := uint64(0) for _, shard := range fld.AvailableShards(true).Slice() { + if isClosing() { + return nil, 0, nil + } if err := func() error { tx, finisher, err := qcx.GetTx(Txo{Write: !writable, Index: idx, Shard: shard}) if err != nil {