Commit 513740f9 authored by Jeromy's avatar Jeromy

fix context respect through fuse reading

parent a83cbb99
...@@ -257,10 +257,10 @@ type nodePromise struct { ...@@ -257,10 +257,10 @@ type nodePromise struct {
// from its internal channels, subsequent calls will return the // from its internal channels, subsequent calls will return the
// cached node. // cached node.
type NodeGetter interface { type NodeGetter interface {
Get() (*Node, error) Get(context.Context) (*Node, error)
} }
func (np *nodePromise) Get() (*Node, error) { func (np *nodePromise) Get(ctx context.Context) (*Node, error) {
if np.cache != nil { if np.cache != nil {
return np.cache, nil return np.cache, nil
} }
...@@ -270,6 +270,8 @@ func (np *nodePromise) Get() (*Node, error) { ...@@ -270,6 +270,8 @@ func (np *nodePromise) Get() (*Node, error) {
np.cache = blk np.cache = blk
case <-np.ctx.Done(): case <-np.ctx.Done():
return nil, np.ctx.Err() return nil, np.ctx.Err()
case <-ctx.Done():
return nil, ctx.Err()
} }
return np.cache, nil return np.cache, nil
} }
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