From b70a4ef2a79378ef951b4ef6a2d74de555a949ee Mon Sep 17 00:00:00 2001 From: Arnaud Date: Thu, 2 Oct 2025 08:39:38 +0200 Subject: [PATCH] Cancel the download in the example to avoid to keep a future and stream running --- examples/golang/codex.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/golang/codex.go b/examples/golang/codex.go index 79714e49..3384105b 100644 --- a/examples/golang/codex.go +++ b/examples/golang/codex.go @@ -1278,6 +1278,12 @@ func main() { log.Println("Codex Download Chunk finished. Size:", len(chunk)) + if err := node.CodexDownloadCancel(cid); err != nil { + log.Fatal("Error happened:", err.Error()) + } + + log.Println("Codex Download Cancel finished.") + manifest, err := node.CodexDownloadManifest(cid) if err != nil { log.Fatal("Error happened:", err.Error())