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.
This commit is contained in:
Anis Elleuch 2021-12-16 17:32:15 +01:00 committed by GitHub
parent 111c6177d2
commit 926373f9c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,17 @@ var (
// initDataScanner will start the scanner in the background. // initDataScanner will start the scanner in the background.
func initDataScanner(ctx context.Context, objAPI ObjectLayer) { 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 { type safeDuration struct {