From 926373f9c1866169f649391359652260169fad0e Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 16 Dec 2021 17:32:15 +0100 Subject: [PATCH] Run the data scanner routine in a loop (#13928) After the introduction of Refresh logic in locks, the data scanner can quit when the data scanner lock is not able to get refreshed. In that case, the context of the data scanner will get canceled and runDataScanner() will quit. Another server would pick the scanning routine but after some time, all nodes can just have all scanning routine aborted, as described above. This fix will just run the data scanner in a loop. --- cmd/data-scanner.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 {