diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 937a315..5f92d32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: curl -L https://github.com/filecoin-station/zinnia/releases/download/v0.10.0/zinnia-linux-x64.tar.gz | tar -xz + - run: curl -L https://github.com/filecoin-station/zinnia/releases/download/v0.11.0/zinnia-linux-x64.tar.gz | tar -xz - uses: actions/setup-node@v3 - run: npx standard - run: ./zinnia run test.js diff --git a/lib/spark.js b/lib/spark.js index d724c4b..4f99b06 100644 --- a/lib/spark.js +++ b/lib/spark.js @@ -14,7 +14,7 @@ export default class Spark { } async getRetrieval () { - console.log('Geting retrieval...') + console.log('Getting retrieval...') const res = await this.#fetch('https://spark.fly.dev/retrievals', { method: 'POST' }) @@ -24,7 +24,7 @@ export default class Spark { } async fetchCAR (url, stats) { - console.log('Fetching CAR...') + console.log(`Fetching ${url}...`) // Abort if no progress was made for 10 seconds const controller = new AbortController() @@ -34,7 +34,7 @@ export default class Spark { if (timeout) { clearTimeout(timeout) } - timeout = setTimeout(() => controller.abort(), 10_000) + timeout = setTimeout(() => controller.abort(), 60_000) } try { @@ -51,6 +51,9 @@ export default class Spark { stats.byteLength += value.byteLength resetTimeout() } + } else { + console.error('Retrieval failed with status code %s: %s', + res.status, await res.text()) } } finally { clearTimeout(timeout) @@ -93,7 +96,11 @@ export default class Spark { byteLength: 0, statusCode: null } - const url = `https://strn.pl/ipfs/${retrieval.cid}` + const searchParams = new URLSearchParams({ + protocols: retrieval.protocol, + providers: retrieval.providerAddress + }) + const url = `ipfs://${retrieval.cid}?${searchParams.toString()}` try { await this.fetchCAR(url, stats) success = true