From 66f69ff9a2e9e50f56e83b3dd5dc8e0244c90093 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Fri, 27 Feb 2026 14:20:57 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20fetch=20log=20=E2=80=94=20overwrite=20pe?= =?UTF-8?q?r-email=20progress=20instead=20of=20appending?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit status.write() per email grows the log unboundedly on big pulls. Now uses status.empty() to create one updatable slot; per-email progress overwrites it, cleared after each account completes. Per-account summaries still use status.write() (one line each). --- app/label_tool.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/label_tool.py b/app/label_tool.py index e84147e..83ebbe2 100644 --- a/app/label_tool.py +++ b/app/label_tool.py @@ -363,6 +363,8 @@ with tab_fetch: fetched_all: list[dict] = [] status = st.status("Fetching…", expanded=True) + # Single updatable slot for per-email progress — overwrites instead of appending + _live = status.empty() for acc in accounts: name = acc.get("name", acc.get("username")) @@ -373,11 +375,13 @@ with tab_fetch: emails = _fetch_account( acc, days=int(days), limit=int(limit), known_keys=existing_keys, - progress_cb=lambda p, msg: status.write(msg), + progress_cb=lambda p, msg: _live.markdown(f"⏳ {msg}"), ) + _live.empty() # clear progress line once account is done fetched_all.extend(emails) status.write(f"✓ {name}: {len(emails)} new emails") except Exception as e: + _live.empty() status.write(f"✗ {name}: {e}") if fetched_all: