Skip to content

Commit

Permalink
make seeder more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
marcklingen committed Jun 19, 2024
1 parent c11a9bb commit 1db8483
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions packages/shared/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,10 @@ async function uploadObjects(
});

for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Sessions ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Sessions ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -395,11 +394,10 @@ async function uploadObjects(
);
});
for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Traces ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Traces ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -413,11 +411,10 @@ async function uploadObjects(
});

for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Observations ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Observations ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -431,11 +428,10 @@ async function uploadObjects(
});

for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Events ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Events ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -448,11 +444,10 @@ async function uploadObjects(
);
});
for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Scores ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Scores ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}
}
Expand Down

0 comments on commit 1db8483

Please sign in to comment.