Save listing error async (#10922)

Since the RPC call may have to time out save an error state async 
to not hold up the listing returning.

Fixes #10919
This commit is contained in:
Klaus Post
2020-11-18 10:28:22 -08:00
committed by GitHub
parent d1b1fee080
commit e413f05397
2 changed files with 22 additions and 14 deletions

View File

@@ -560,13 +560,15 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr
console.Println("listPath returning:", entries.len(), "err:", err)
}
if err != nil && err != io.EOF {
metaMu.Lock()
if meta.status != scanStateError {
meta.error = err.Error()
meta.status = scanStateError
}
meta, _ = o.updateMetacacheListing(meta, rpc)
metaMu.Unlock()
go func(err string) {
metaMu.Lock()
if meta.status != scanStateError {
meta.error = err
meta.status = scanStateError
}
meta, _ = o.updateMetacacheListing(meta, rpc)
metaMu.Unlock()
}(err.Error())
cancel()
}
}()