Skip to content

Commit

Permalink
fix: print log for progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
tungv committed Aug 21, 2024
1 parent e82dee6 commit 9899af1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/jerni/jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jerni/jerni-3",
"version": "0.9.8",
"version": "0.9.9",
"exports": {
".": "./src/createJourney.ts",
"./types": "./src/lib/exported_types.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/jerni/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jerni/jerni-3",
"version": "v0.9.8",
"version": "v0.9.9",
"type": "module",
"main": "src/index.ts",
"bin": {
Expand Down
6 changes: 4 additions & 2 deletions packages/jerni/src/begin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ export default async function* begin(journey: JourneyInstance, signal: AbortSign
() => {
const timeElapsed = Date.now() - lastProcessingTime;
const percentage = (timeElapsed / timeBudget) * 100;
const bar = "█".repeat(Math.floor(percentage / 11));
const space = "_".repeat(11 - bar.length);
const lengthToRender = Math.min(Math.floor(percentage / 11), 11);

const bar = "█".repeat(lengthToRender);
const space = "_".repeat(11 - lengthToRender);

logger.info(
`${INF} [HANDLING_EVENT] ${batchLabel}: [${bar}${space}] ${percentage.toFixed(1)}% of ${timeBudgetString}`,
Expand Down

0 comments on commit 9899af1

Please sign in to comment.