From 38b359a72d57f7ab7e50ed2c02dfd972440e5fc9 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 23 Dec 2025 16:31:12 +0100 Subject: [PATCH] feat: Add periodic throughput reporting to progress tracker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/utils/progress.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/progress.py b/src/utils/progress.py index 99f632a..0acaf54 100644 --- a/src/utils/progress.py +++ b/src/utils/progress.py @@ -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: