Skip to content

Commit

Permalink
fix(alerts): Use partial instead of lambda to prevent late binding bu…
Browse files Browse the repository at this point in the history
…gs in update_es_documents
  • Loading branch information
albertisfu committed Oct 18, 2024
1 parent 180727a commit b1f2d13
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions cl/lib/es_signal_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,22 @@ def update_es_documents(
# Update main document in ES, including fields to be
# extracted from a related instance.
transaction.on_commit(
lambda: chain(
update_es_document.si(
es_document.__name__,
fields_to_update,
(
compose_app_label(instance),
instance.pk,
partial(
chain(
update_es_document.si(
es_document.__name__,
fields_to_update,
(
compose_app_label(instance),
instance.pk,
),
(compose_app_label(instance), instance.pk),
fields_map,
),
(compose_app_label(instance), instance.pk),
fields_map,
),
send_or_schedule_search_alerts.s(),
percolator_response_processing.s(),
).apply_async()
send_or_schedule_search_alerts.s(),
percolator_response_processing.s(),
).apply_async
)
)
case OpinionCluster() if es_document is OpinionDocument: # type: ignore
transaction.on_commit(
Expand Down

0 comments on commit b1f2d13

Please sign in to comment.