diff --git a/bsky.py b/bsky.py index c0ed127..4382051 100644 --- a/bsky.py +++ b/bsky.py @@ -8,7 +8,7 @@ import json import hashlib import subprocess from pathlib import Path -from datetime import datetime +from datetime import datetime, timedelta from collections import defaultdict import time import argparse @@ -1419,8 +1419,18 @@ def fetch_and_queue_new_notifications(atproto_client): processed_uris = load_processed_notifications() # Queue all new notifications (except likes) + # Calculate cutoff time: 1 month ago from now + one_month_ago = (datetime.now() - timedelta(days=30)).isoformat() + for notif in all_notifications: - # Skip if older than last processed (when we have timestamp filtering) + # Skip if older than 1 month + if hasattr(notif, 'indexed_at'): + if notif.indexed_at < one_month_ago: + skipped_old_timestamp += 1 + logger.debug(f"Skipping old notification (older than 1 month): {notif.indexed_at}") + continue + + # Also skip if older than last processed (when we have timestamp filtering) if last_processed_time and hasattr(notif, 'indexed_at'): if notif.indexed_at <= last_processed_time: skipped_old_timestamp += 1