fix: fetch log — overwrite per-email progress instead of appending
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).
This commit is contained in:
parent
2824fca70c
commit
66f69ff9a2
1 changed files with 5 additions and 1 deletions
|
|
@ -363,6 +363,8 @@ with tab_fetch:
|
||||||
|
|
||||||
fetched_all: list[dict] = []
|
fetched_all: list[dict] = []
|
||||||
status = st.status("Fetching…", expanded=True)
|
status = st.status("Fetching…", expanded=True)
|
||||||
|
# Single updatable slot for per-email progress — overwrites instead of appending
|
||||||
|
_live = status.empty()
|
||||||
|
|
||||||
for acc in accounts:
|
for acc in accounts:
|
||||||
name = acc.get("name", acc.get("username"))
|
name = acc.get("name", acc.get("username"))
|
||||||
|
|
@ -373,11 +375,13 @@ with tab_fetch:
|
||||||
emails = _fetch_account(
|
emails = _fetch_account(
|
||||||
acc, days=int(days), limit=int(limit),
|
acc, days=int(days), limit=int(limit),
|
||||||
known_keys=existing_keys,
|
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)
|
fetched_all.extend(emails)
|
||||||
status.write(f"✓ {name}: {len(emails)} new emails")
|
status.write(f"✓ {name}: {len(emails)} new emails")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
_live.empty()
|
||||||
status.write(f"✗ {name}: {e}")
|
status.write(f"✗ {name}: {e}")
|
||||||
|
|
||||||
if fetched_all:
|
if fetched_all:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue