fix: [30388f42] Überspringe Jobs ohne ContactId oder PersonId
- Fügt eine Early-Exit-Bedingung zum Worker hinzu, um Jobs zu überspringen, die weder eine ContactId noch eine PersonId enthalten. - Behebt das Problem, dass 'test.ping'-Jobs oder andere fehlerhafte Payloads zu 'FAILED'-Einträgen führen.
This commit is contained in:
@@ -52,7 +52,7 @@ def process_job(job, so_client: SuperOfficeClient, queue: JobQueue):
|
|||||||
return ("SKIPPED", msg)
|
return ("SKIPPED", msg)
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
|
||||||
# 0. Noise Reduction: Filter irrelevant field changes
|
# 0. ID Extraction & Early Exit for irrelevant jobs
|
||||||
person_id = None
|
person_id = None
|
||||||
contact_id = None
|
contact_id = None
|
||||||
job_title = payload.get("JobTitle")
|
job_title = payload.get("JobTitle")
|
||||||
@@ -77,6 +77,12 @@ def process_job(job, so_client: SuperOfficeClient, queue: JobQueue):
|
|||||||
elif "PrimaryKey" in payload and "contact" in event_low:
|
elif "PrimaryKey" in payload and "contact" in event_low:
|
||||||
contact_id = int(payload["PrimaryKey"])
|
contact_id = int(payload["PrimaryKey"])
|
||||||
|
|
||||||
|
# If after all checks, we have no ID, we can't process it.
|
||||||
|
if not person_id and not contact_id:
|
||||||
|
msg = f"Skipping job: No ContactId or PersonId could be identified in the payload."
|
||||||
|
logger.warning(msg)
|
||||||
|
return ("SKIPPED", msg)
|
||||||
|
|
||||||
# Fallback/Deep Lookup & Fetch JobTitle if missing
|
# Fallback/Deep Lookup & Fetch JobTitle if missing
|
||||||
if person_id and (not job_title or not contact_id):
|
if person_id and (not job_title or not contact_id):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user