sub timeout for fs init
This commit is contained in:
parent
c1003c3314
commit
bcda69daad
5 changed files with 57 additions and 28 deletions
src/host/vfs
|
@ -119,17 +119,26 @@ func (r *ResolverFS) ReadDir(ctx context.Context, dir string) ([]fs.DirEntry, er
|
|||
return nil, err
|
||||
}
|
||||
defer file.Close(ctx)
|
||||
nestedfs, err := r.resolver.nestedFs(ctx, filepath, file)
|
||||
if err != nil {
|
||||
if errors.Is(err, context.DeadlineExceeded) {
|
||||
r.log.ErrorContext(ctx, "creating fs timed out", "filename", e.Name())
|
||||
continue
|
||||
}
|
||||
|
||||
err = func() error {
|
||||
factoryCtx, cancel := subTimeout(ctx)
|
||||
defer cancel()
|
||||
nestedfs, err := r.resolver.nestedFs(factoryCtx, filepath, file)
|
||||
if err != nil {
|
||||
if errors.Is(err, context.DeadlineExceeded) {
|
||||
r.log.ErrorContext(ctx, "creating fs timed out", "filename", e.Name())
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
out = append(out, nestedfs)
|
||||
return nil
|
||||
}()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out = append(out, nestedfs)
|
||||
} else {
|
||||
out = append(out, e)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue