From 6210d89270df48b6b493167d465f3110eacdb332 Mon Sep 17 00:00:00 2001 From: Jose Lago Date: Wed, 17 Jun 2026 09:25:26 +0200 Subject: [PATCH] fix: only notify for genuinely new ads, not every ad on page --- worker/src/main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/worker/src/main.py b/worker/src/main.py index f040201..06a8202 100644 --- a/worker/src/main.py +++ b/worker/src/main.py @@ -74,6 +74,13 @@ async def scheduler_task(pool: object, bot: ExtBot) -> None: fields.get("main_image_url"), fields.get("postcode"), fields.get("modified_at"), ) ad_uuid = str(ad_row["id"]) + + # Only notify for genuinely new ads after baseline load is done + if initial_loaded: + notify_fields = {**fields, "keyword": keyword} + for tg_id in telegram_ids: + await notify_new_ad(bot, tg_id, notify_fields) + new_count += 1 else: ad_uuid = str(existing["id"]) old_price = existing["price"] @@ -96,12 +103,6 @@ async def scheduler_task(pool: object, bot: ExtBot) -> None: fields.get("main_image_url"), fields.get("postcode"), ad_uuid, ) - if initial_loaded: - notify_fields = {**fields, "keyword": keyword} - for tg_id in telegram_ids: - await notify_new_ad(bot, tg_id, notify_fields) - new_count += 1 - if is_price_drop: notify_fields = {**fields, "keyword": keyword} for tg_id in telegram_ids: