fix: mark GitHub notifications as read after DB insert

Prevents accumulation of ~5000 unread notifications on GitHub,
which caused argus notif pull to paginate through all of them
on every poll (taking 10-20s instead of <1s).

Each notification is marked as read via PATCH /notifications/threads/{id}
immediately after being inserted into the DB. Best-effort — failures
don't break the pull.
This commit is contained in:
Nazim 2026-03-26 15:36:46 +00:00
parent f37f3d62f6
commit 34dfdaaa70

View file

@ -651,6 +651,17 @@ def cmd_notif_pull(args) -> None:
dismissed_count += 1 dismissed_count += 1
else: else:
kept_count += 1 kept_count += 1
# Mark as read on GitHub (prevents re-fetching ~5000 stale notifications)
if not args.dry_run and backend == "gh":
try:
subprocess.run(
["gh", "api", "--method", "PATCH",
f"notifications/threads/{notif_id}"],
capture_output=True, text=True, check=False
)
except Exception:
pass # Best-effort — don't fail the pull if marking read fails
if not args.dry_run: if not args.dry_run:
# Record poll # Record poll