mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-24 22:38:27 +08:00
explain when a promise can be canceled in pbdagreader
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
@ -110,6 +110,11 @@ func (dr *PBDagReader) precalcNextBuf(ctx context.Context) error {
|
|||||||
// In this case, the context used to *preload* the node has been canceled.
|
// In this case, the context used to *preload* the node has been canceled.
|
||||||
// We need to retry the load with our context and we might as
|
// We need to retry the load with our context and we might as
|
||||||
// well preload some extra nodes while we're at it.
|
// well preload some extra nodes while we're at it.
|
||||||
|
//
|
||||||
|
// Note: When using `Read`, this code will never execute as
|
||||||
|
// `Read` will use the global context. It only runs if the user
|
||||||
|
// explicitly reads with a custom context (e.g., by calling
|
||||||
|
// `CtxReadFull`).
|
||||||
dr.preload(ctx, dr.linkPosition)
|
dr.preload(ctx, dr.linkPosition)
|
||||||
nxt, err = dr.promises[dr.linkPosition].Get(ctx)
|
nxt, err = dr.promises[dr.linkPosition].Get(ctx)
|
||||||
dr.promises[dr.linkPosition] = nil
|
dr.promises[dr.linkPosition] = nil
|
||||||
|
Reference in New Issue
Block a user