Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Commit e418913

Browse files
juliangruberbajtos
andauthored
Lassie (#5)
* ci: upgrade zinnia * fetch from lassie not saturn * fix typo * log * increase receive timeout * add log http error text * add pass protocol and provider to lassie * safely construct querystrings * fix lint * Update lib/spark.js Co-authored-by: Miroslav Bajtoš <oss@bajtos.net> --------- Co-authored-by: Miroslav Bajtoš <oss@bajtos.net>
1 parent 267e1d0 commit e418913

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v3
8-
- run: curl -L https://github.com/filecoin-station/zinnia/releases/download/v0.10.0/zinnia-linux-x64.tar.gz | tar -xz
8+
- run: curl -L https://github.com/filecoin-station/zinnia/releases/download/v0.11.0/zinnia-linux-x64.tar.gz | tar -xz
99
- uses: actions/setup-node@v3
1010
- run: npx standard
1111
- run: ./zinnia run test.js

lib/spark.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class Spark {
1414
}
1515

1616
async getRetrieval () {
17-
console.log('Geting retrieval...')
17+
console.log('Getting retrieval...')
1818
const res = await this.#fetch('https://spark.fly.dev/retrievals', {
1919
method: 'POST'
2020
})
@@ -24,7 +24,7 @@ export default class Spark {
2424
}
2525

2626
async fetchCAR (url, stats) {
27-
console.log('Fetching CAR...')
27+
console.log(`Fetching ${url}...`)
2828

2929
// Abort if no progress was made for 10 seconds
3030
const controller = new AbortController()
@@ -34,7 +34,7 @@ export default class Spark {
3434
if (timeout) {
3535
clearTimeout(timeout)
3636
}
37-
timeout = setTimeout(() => controller.abort(), 10_000)
37+
timeout = setTimeout(() => controller.abort(), 60_000)
3838
}
3939

4040
try {
@@ -51,6 +51,9 @@ export default class Spark {
5151
stats.byteLength += value.byteLength
5252
resetTimeout()
5353
}
54+
} else {
55+
console.error('Retrieval failed with status code %s: %s',
56+
res.status, await res.text())
5457
}
5558
} finally {
5659
clearTimeout(timeout)
@@ -93,7 +96,11 @@ export default class Spark {
9396
byteLength: 0,
9497
statusCode: null
9598
}
96-
const url = `https://strn.pl/ipfs/${retrieval.cid}`
99+
const searchParams = new URLSearchParams({
100+
protocols: retrieval.protocol,
101+
providers: retrieval.providerAddress
102+
})
103+
const url = `ipfs://${retrieval.cid}?${searchParams.toString()}`
97104
try {
98105
await this.fetchCAR(url, stats)
99106
success = true

0 commit comments

Comments
 (0)