const uploads = await Promise.all(
batch.map(async (image, index) => {
// Add 1 second sleep between uploads, but not before the first one
if (index > 0) {
await step.sleep(`delay-upload-${i}-${index}`, "1 second");
}
return step.do(
`process-image-${i}`,
{
retries: {
limit: 3,
delay: "5 seconds",
backoff: "exponential",
},
},
() => this.downloadAndUploadImage(image, orgId)
);
})
);
const uploads = await Promise.all(
batch.map(async (image, index) => {
// Add 1 second sleep between uploads, but not before the first one
if (index > 0) {
await step.sleep(`delay-upload-${i}-${index}`, "1 second");
}
return step.do(
`process-image-${i}`,
{
retries: {
limit: 3,
delay: "5 seconds",
backoff: "exponential",
},
},
() => this.downloadAndUploadImage(image, orgId)
);
})
);