diff --git a/cmd/data-scanner.go b/cmd/data-scanner.go index e77539b1a..db1e72675 100644 --- a/cmd/data-scanner.go +++ b/cmd/data-scanner.go @@ -71,7 +71,17 @@ var ( // initDataScanner will start the scanner in the background. func initDataScanner(ctx context.Context, objAPI ObjectLayer) { - go runDataScanner(ctx, objAPI) + go func() { + // Run the data scanner in a loop + for { + select { + case <-ctx.Done(): + return + default: + runDataScanner(ctx, objAPI) + } + } + }() } type safeDuration struct {