fix: [30388f42] Worker v1.9.10 - Präzisiere Personen-Filter für Stammdaten

- Erweitert den Filter für  Events auf Änderungen in , ,  oder .
- Schließt die Lücke, die  Events in eine Endlosschleife schicken konnte.
- Stellt sicher, dass nur wirklich relevante Personen-Updates eine Verarbeitung triggern.
This commit is contained in:
2026-03-06 18:16:15 +00:00
parent bad4fcb0a0
commit d7fca780c2

View File

@@ -45,26 +45,29 @@ def process_job(job, so_client: SuperOfficeClient, queue: JobQueue):
Returns: (STATUS, MESSAGE)
STATUS: 'SUCCESS', 'SKIPPED', 'DELETED', 'RETRY', 'FAILED'
"""
logger.info(f"--- [WORKER v1.9.8 - THE FORTRESS] Processing Job {job['id']} ({job['event_type']}) ---")
logger.info(f"--- [WORKER v1.9.9 - ABSOLUTE FILTERS] Processing Job {job['id']} ({job['event_type']}) ---")
payload = job['payload']
event_low = job['event_type'].lower()
# --- NOISE REDUCTION: STRICT STAMMDATEN FILTER ---
# We ONLY react to changes in critical fields. Our own UDF updates must be ignored.
# --- NOISE REDUCTION: STRICT STAMMDATEN FILTER (v1.9.9) ---
# We ONLY react to changes in critical fields.
# For .created events, we also check if name/urladdress are explicitly in the payload changes.
changes = [c.lower() for c in payload.get("Changes", [])]
if "contact.changed" in event_low:
if "name" not in changes and "urladdress" not in changes:
msg = f"Skipping contact change: No changes to name or website in {changes}."
# RULE: If it's a person event, we ONLY care if name, email, or jobtitle changed (for role mapping).
# If it's a contact event, we ONLY care if name or website changed.
if "person" in event_low:
if "name" not in changes and "email" not in changes and "jobtitle" not in changes and "contact_id" not in changes:
msg = f"Skipping person event: No relevant changes (Name/Email/JobTitle/Mapping) in {changes}."
logger.info(f"⏭️ {msg}")
return ("SKIPPED", msg)
if "person.changed" in event_low:
if "jobtitle" not in changes and "contact_id" not in changes:
msg = f"Skipping person change: No changes to jobtitle or contact mapping in {changes}."
elif "contact" in event_low:
if "name" not in changes and "urladdress" not in changes:
msg = f"Skipping contact event: No relevant changes (Name/Website) in {changes}."
logger.info(f"⏭️ {msg}")
return ("SKIPPED", msg)
# -------------------------------------------------
# ---------------------------------------------------------
# --- CIRCUIT BREAKER: DETECT ECHOES ---