diff --git a/services/ipos/src/routes/pinning.ts b/services/ipos/src/routes/pinning.ts index 112a537..3c6c263 100644 --- a/services/ipos/src/routes/pinning.ts +++ b/services/ipos/src/routes/pinning.ts @@ -91,11 +91,13 @@ app.post('/pinFile', vValidator('form', pinFileRequestSchema), async (c) => { }, }) + const promises: Promise[] = [] for (const { file } of files) { const path = `${cid}/${file.name}` - c.executionCtx.waitUntil(c.env.BUCKET.put(keyOf(path), file)) + promises.push(c.env.BUCKET.put(keyOf(path), file)) } + c.executionCtx.waitUntil(Promise.allSettled(promises)) } else { const { content, file: f } = files[0] cid = (await hashOf(content)).toV0().toString()