feat: Add periodic throughput reporting to progress tracker

For very large migrations (111M rows), the progress bar can appear frozen
when showing percentage-based progress on 60M+ remaining rows. Even at
20k rows/sec, progress moves slowly on screen.

Solution: Print periodic throughput updates every 1M rows processed.
Shows:
- Actual count processed and total
- Current throughput in rows/sec
- Elapsed time in hours

This gives users visual feedback that migration is actively processing
without needing to wait for percentage to visibly change.

Example output:
  Progress: 5,000,000/111,000,000 items (18,500 items/sec, 4.2h elapsed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-23 16:31:12 +01:00
parent 7cb4783385
commit 38b359a72d

View File

@@ -67,6 +67,17 @@ class ProgressTracker:
self.progress.update(self.task_id, advance=advance)
self.processed += advance
# For very large totals (e.g., migrations), show throughput periodically
# to give visual feedback even when progress percentage seems stuck
if self.processed % 1000000 == 0 and self.processed > 0:
elapsed = time.time() - self.start_time
if elapsed > 0:
rate = self.processed / elapsed
self.progress.print(
f"[cyan]Progress: {self.processed:,}/{self.total:,} items "
f"({rate:.0f} items/sec, {elapsed/3600:.1f}h elapsed)[/cyan]"
)
def print_status(self, message: str):
"""Print a status message without interrupting progress bar."""
if self.task_id is not None: