From 4abb6ca484da937a13cc957db9670ce44191de34 Mon Sep 17 00:00:00 2001 From: hannahhoward Date: Wed, 17 May 2023 07:29:54 -0700 Subject: [PATCH] fix(dagula): use parallelMap so DFS works --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fb35e61..597c6d3 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ import { CID } from 'multiformats/cid' import * as dagPB from '@ipld/dag-pb' import * as Block from 'multiformats/block' import { exporter, walkPath } from 'ipfs-unixfs-exporter' -import { transform } from 'streaming-iterables' +import { parallelMap, transform } from 'streaming-iterables' import { Decoders, Hashers } from './defaults.js' import { identity } from 'multiformats/hashes/identity' @@ -50,7 +50,8 @@ export class Dagula { while (cids.length > 0) { log('fetching %d CIDs', cids.length) - const fetchBlocks = transform(cids.length, async cid => { + const parallelFn = order === 'dfs' ? parallelMap : transform + const fetchBlocks = parallelFn(cids.length, async cid => { if (signal) { const aborter = new AbortController() aborters.push(aborter)