mirror of https://github.com/minio/minio.git
Clean up metacache saver (#13225)
Don't report success before the listing has actually finished. This will make stop conditions more clear.
This commit is contained in:
parent
45bcf73185
commit
d80826b05d
|
@ -720,26 +720,23 @@ func (er *erasureObjects) saveMetaCacheStream(ctx context.Context, mc *metaCache
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
metaMu.Lock()
|
// Blocks while consuming entries or an error occurs.
|
||||||
|
err = bw.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
mc.setErr(err.Error())
|
mc.setErr(err.Error())
|
||||||
return
|
}
|
||||||
|
metaMu.Lock()
|
||||||
|
defer metaMu.Unlock()
|
||||||
|
if mc.meta.error != "" {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
// Save success
|
// Save success
|
||||||
if mc.meta.error == "" {
|
mc.meta.status = scanStateSuccess
|
||||||
mc.meta.status = scanStateSuccess
|
meta, err := o.updateMetacacheListing(*mc.meta, rpc)
|
||||||
|
if err == nil {
|
||||||
|
*mc.meta = meta
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
meta := *mc.meta
|
|
||||||
meta, _ = o.updateMetacacheListing(meta, rpc)
|
|
||||||
*mc.meta = meta
|
|
||||||
metaMu.Unlock()
|
|
||||||
|
|
||||||
if err := bw.Close(); err != nil {
|
|
||||||
mc.setErr(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type listPathRawOptions struct {
|
type listPathRawOptions struct {
|
||||||
|
|
Loading…
Reference in New Issue