Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid car repack #2552

Merged
merged 9 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
} from './middleware/maintenance.js'
import { getContext } from './utils/context.js'
import { withAuth } from './middleware/auth.js'
import { repl } from './repl.js'

const r = new Router(getContext, {
onError(req, err, ctx) {
Expand All @@ -48,10 +47,6 @@ const checkHasDeleteRestriction = true
const checkHasPsaAccess = true
const checkUcan = true

// Debugging

r.add('post', '/repl', repl)

// Monitoring
r.add('get', '/metrics', withMode(metrics, RO))
r.add('get', '/stats', withMode(getStats, RO), [postCors])
Expand Down
22 changes: 0 additions & 22 deletions packages/api/src/repl.js

This file was deleted.

11 changes: 10 additions & 1 deletion packages/api/src/routes/nfts-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,16 @@ export async function uploadCarWithStat(
const { w3up } = ctx

console.log('UPLOADING CAR')
await w3up.capability.store.add(car)

// we perform store/add and upload/add concurrently to save time.
await Promise.all([
w3up.capability.store.add(car),
// We create an upload for each CAR and use it's CID as a shard, which
// will work as expected because `upload/add` merges all shards.
// @ts-expect-error Link types mismatch
w3up.capability.upload.add(stat.rootCid, [stat.cid]),
])

console.log('UPLOADED CAR')
// register as gateway links to record the CAR CID - we don't have another
// way to know the location right now.
Expand Down
Loading