From 3b172b2416aee89c8aa98dd065afd044a827c7e4 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 29 Jan 2025 23:09:49 -0600 Subject: [PATCH] Fix notified user logic --- src/ai_marketplace_monitor/monitor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ai_marketplace_monitor/monitor.py b/src/ai_marketplace_monitor/monitor.py index 5f87e2b..11de059 100644 --- a/src/ai_marketplace_monitor/monitor.py +++ b/src/ai_marketplace_monitor/monitor.py @@ -324,7 +324,7 @@ def notify_users( msgs = [] unnotified_items = [] for item in items: - if ("notify_user", item["id"]) not in cache or user not in cache.get( + if ("notify_user", item["id"]) in cache and user in cache.get( ("notify_user", item["id"]), () ): continue @@ -336,6 +336,9 @@ def notify_users( ) unnotified_items.append(item) + if not unnotified_items: + continue + title = f"Found {len(msgs)} new item from {item['marketplace']}: " message = "\n\n".join(msgs) self.logger.info(