diff --git a/codex/erasure/erasure.nim b/codex/erasure/erasure.nim index f828f03a..ecf911bc 100644 --- a/codex/erasure/erasure.nim +++ b/codex/erasure/erasure.nim @@ -120,7 +120,8 @@ proc getPendingBlocks( CatchableError, "Future for block id not found, tree cid: " & $manifest.treeCid & ", index: " & $index) - newAsyncIter[(?!bt.Block, int)](genNext, isFinished) + # newAsyncIter[(?!bt.Block, int)](genNext, isFinished) + asynciter.AsyncIter.new[(?!bt.Block, int)](genNext, isFinished) proc prepareEncodingData( self: Erasure, diff --git a/codex/utils/asynciter.nim b/codex/utils/asynciter.nim index 8035be0e..3acff009 100644 --- a/codex/utils/asynciter.nim +++ b/codex/utils/asynciter.nim @@ -64,6 +64,12 @@ proc newAsyncIter*[T](genNext: GenNext[Future[T]], isFinished: IsFinished, finis iter.next = next return iter +proc new*[T](_: type AsyncIter, genNext: GenNext[Future[T]], isFinished: IsFinished, finishOnErr: bool = true): AsyncIter[T] = + newAsyncIter[T]( + genNext, + isFinished + ) + proc emptyAsyncIter*[T](): AsyncIter[T] = ## Creates an empty AsyncIter ##