Commit 312a1177 authored by Jakub Sztandera's avatar Jakub Sztandera

flatfs: not error out Walk in case of FileNotFound error

This is to prevent race that can happen while GCing the repo
Walk will build list of files and one of those files can be removed
by GC, currently it causes a failure which shouldn't be the case.

License: MIT
Signed-off-by: default avatarJakub Sztandera <kubuxu@protonmail.ch>
parent f6dfcbd0
...@@ -313,6 +313,9 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) { ...@@ -313,6 +313,9 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
go func() { go func() {
defer close(reschan) defer close(reschan)
err := filepath.Walk(fs.path, func(path string, info os.FileInfo, err error) error { err := filepath.Walk(fs.path, func(path string, info os.FileInfo, err error) error {
if os.IsNotExist(err) {
return nil
}
if err != nil { if err != nil {
log.Errorf("Walk func in Query got error: %v", err) log.Errorf("Walk func in Query got error: %v", err)
return err return err
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment