Skip to content

Commit 7fd3404

Browse files
committed
explain when a promise can be canceled in pbdagreader
License: MIT Signed-off-by: Steven Allen <[email protected]>
1 parent 5c0dc6a commit 7fd3404

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

unixfs/io/pbdagreader.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ func (dr *PBDagReader) precalcNextBuf(ctx context.Context) error {
110110
// In this case, the context used to *preload* the node has been canceled.
111111
// We need to retry the load with our context and we might as
112112
// well preload some extra nodes while we're at it.
113+
//
114+
// Note: When using `Read`, this code will never execute as
115+
// `Read` will use the global context. It only runs if the user
116+
// explicitly reads with a custom context (e.g., by calling
117+
// `CtxReadFull`).
113118
dr.preload(ctx, dr.linkPosition)
114119
nxt, err = dr.promises[dr.linkPosition].Get(ctx)
115120
dr.promises[dr.linkPosition] = nil

0 commit comments

Comments
 (0)