From c0e79e28b25da4212467d1d7ecc767e732f384c2 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 3 Jun 2021 19:18:59 -0700 Subject: [PATCH] fix: close the channel appropriately for dataUsageEntry (#12432) Bonus: initialize dataScanner routines after server config has initialized. fixes #12430 --- cmd/fs-v1.go | 2 ++ cmd/server-main.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/fs-v1.go b/cmd/fs-v1.go index 7b33a188d..179c5ea00 100644 --- a/cmd/fs-v1.go +++ b/cmd/fs-v1.go @@ -333,6 +333,8 @@ func (fs *FSObjects) NSScanner(ctx context.Context, bf *bloomFilter, updates cha // The updated cache for the bucket is returned. // A partially updated bucket may be returned. func (fs *FSObjects) scanBucket(ctx context.Context, bucket string, cache dataUsageCache) (dataUsageCache, error) { + defer close(cache.Info.updates) + // Get bucket policy // Check if the current bucket has a configured lifecycle policy lc, err := globalLifecycleSys.Get(bucket) diff --git a/cmd/server-main.go b/cmd/server-main.go index 4429a688a..3d5e9cd27 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -531,7 +531,6 @@ func serverMain(ctx *cli.Context) { } initBackgroundExpiry(GlobalContext, newObject) - initDataScanner(GlobalContext, newObject) if err = initServer(GlobalContext, newObject); err != nil { var cerr config.Err @@ -549,6 +548,8 @@ func serverMain(ctx *cli.Context) { logger.LogIf(GlobalContext, err) } + initDataScanner(GlobalContext, newObject) + if globalIsErasure { // to be done after config init initBackgroundReplication(GlobalContext, newObject) globalTierJournal, err = initTierDeletionJournal(GlobalContext.Done())