Skip to content

Commit

Permalink
Fix empty ETA for fast machines
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Sep 15, 2024
1 parent 78cf37e commit 1d328e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sisi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ export async function index(targetDir: string) {
if (totalFiles.count > 0) {
console.log(`${index.has(targetDir) ? 'Build' : 'Updat'}ing index for ${totalFiles.count} images...`);
let lastUpdate = Date.now() - 2000;
let lastEta = '';
let lastEta = 'Waiting';
bar = new SingleBar({
etaBuffer: batchSize * 4, // estimate eta on last 4 batches
format: '{bar} | ETA: {eta_formatted} | {value}/{total}',
formatTime(eta) {
if (progress.size == 0) // no eta when nothing has been processed
return 'Waiting';
return lastEta;
if (Date.now() - lastUpdate < 5000) // smooth eta updates
return lastEta;
lastUpdate = Date.now();
Expand Down

0 comments on commit 1d328e3

Please sign in to comment.