From 34dfdaaa7022fb30181b7782cafec69534c6acd0 Mon Sep 17 00:00:00 2001 From: Nazim Date: Thu, 26 Mar 2026 15:36:46 +0000 Subject: [PATCH] fix: mark GitHub notifications as read after DB insert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- bin/argus | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/argus b/bin/argus index 1186c49..c4177c6 100755 --- a/bin/argus +++ b/bin/argus @@ -651,6 +651,17 @@ def cmd_notif_pull(args) -> None: dismissed_count += 1 else: 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: # Record poll