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:
@@ -45,26 +45,29 @@ def process_job(job, so_client: SuperOfficeClient, queue: JobQueue):
|
|||||||
Returns: (STATUS, MESSAGE)
|
Returns: (STATUS, MESSAGE)
|
||||||
STATUS: 'SUCCESS', 'SKIPPED', 'DELETED', 'RETRY', 'FAILED'
|
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']
|
payload = job['payload']
|
||||||
event_low = job['event_type'].lower()
|
event_low = job['event_type'].lower()
|
||||||
|
|
||||||
# --- NOISE REDUCTION: STRICT STAMMDATEN FILTER ---
|
# --- NOISE REDUCTION: STRICT STAMMDATEN FILTER (v1.9.9) ---
|
||||||
# We ONLY react to changes in critical fields. Our own UDF updates must be ignored.
|
# 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", [])]
|
changes = [c.lower() for c in payload.get("Changes", [])]
|
||||||
|
|
||||||
if "contact.changed" in event_low:
|
# RULE: If it's a person event, we ONLY care if name, email, or jobtitle changed (for role mapping).
|
||||||
if "name" not in changes and "urladdress" not in changes:
|
# If it's a contact event, we ONLY care if name or website changed.
|
||||||
msg = f"Skipping contact change: No changes to name or website in {changes}."
|
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}")
|
logger.info(f"⏭️ {msg}")
|
||||||
return ("SKIPPED", msg)
|
return ("SKIPPED", msg)
|
||||||
|
|
||||||
if "person.changed" in event_low:
|
elif "contact" in event_low:
|
||||||
if "jobtitle" not in changes and "contact_id" not in changes:
|
if "name" not in changes and "urladdress" not in changes:
|
||||||
msg = f"Skipping person change: No changes to jobtitle or contact mapping in {changes}."
|
msg = f"Skipping contact event: No relevant changes (Name/Website) in {changes}."
|
||||||
logger.info(f"⏭️ {msg}")
|
logger.info(f"⏭️ {msg}")
|
||||||
return ("SKIPPED", msg)
|
return ("SKIPPED", msg)
|
||||||
# -------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|
||||||
# --- CIRCUIT BREAKER: DETECT ECHOES ---
|
# --- CIRCUIT BREAKER: DETECT ECHOES ---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user