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:
parent
f37f3d62f6
commit
34dfdaaa70
1 changed files with 11 additions and 0 deletions
11
bin/argus
11
bin/argus
|
|
@ -652,6 +652,17 @@ def cmd_notif_pull(args) -> None:
|
||||||
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
|
||||||
conn.execute(
|
conn.execute(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue