Skip to content

Commit

Permalink
Merge pull request #3281 from freelawproject/3265-fix-not-found-error…
Browse files Browse the repository at this point in the history
…-indexing-parties

3265 Fix docket not found in ES when indexing parties.
  • Loading branch information
mlissner authored Oct 19, 2023
2 parents 72d5190 + d718797 commit 7ef947a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion cl/lib/pacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ def process_docket_data(
UPLOAD_TYPE.IA_XML_FILE,
):
add_parties_and_attorneys(d, data["parties"])
index_docket_parties_in_es.delay(d.pk)
if data["parties"]:
# Index or re-index parties only if the docket has parties.
index_docket_parties_in_es.delay(d.pk)
return d.pk


Expand Down
4 changes: 3 additions & 1 deletion cl/recap/mergers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,9 @@ def merge_pacer_docket_into_cl_docket(
add_docket_entries
)(d, docket_data["docket_entries"], tags=tags)
add_parties_and_attorneys(d, docket_data["parties"])
index_docket_parties_in_es.delay(d.pk)
if docket_data["parties"]:
# Index or re-index parties only if the docket has parties.
index_docket_parties_in_es.delay(d.pk)
async_to_sync(process_orphan_documents)(
rds_created, d.court_id, d.date_filed
)
Expand Down
8 changes: 6 additions & 2 deletions cl/recap/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,9 @@ async def process_recap_docket(pk):
d, data["docket_entries"]
)
await sync_to_async(add_parties_and_attorneys)(d, data["parties"])
await sync_to_async(index_docket_parties_in_es.delay)(d.pk)
if data["parties"]:
# Index or re-index parties only if the docket has parties.
await sync_to_async(index_docket_parties_in_es.delay)(d.pk)
await process_orphan_documents(rds_created, pq.court_id, d.date_filed)
if content_updated:
newly_enqueued = enqueue_docket_alert(d.pk)
Expand Down Expand Up @@ -1052,7 +1054,9 @@ async def process_recap_appellate_docket(pk):
d, data["docket_entries"]
)
await sync_to_async(add_parties_and_attorneys)(d, data["parties"])
await sync_to_async(index_docket_parties_in_es.delay)(d.pk)
if data["parties"]:
# Index or re-index parties only if the docket has parties.
await sync_to_async(index_docket_parties_in_es.delay)(d.pk)
await process_orphan_documents(rds_created, pq.court_id, d.date_filed)
if content_updated:
newly_enqueued = enqueue_docket_alert(d.pk)
Expand Down
7 changes: 3 additions & 4 deletions cl/search/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def update_child_documents_by_query(
# New task.
@app.task(
bind=True,
autoretry_for=(ConnectionError, NotFoundError),
autoretry_for=(ConnectionError,),
max_retries=3,
interval_start=5,
queue=settings.CELERY_ETL_TASK_QUEUE,
Expand Down Expand Up @@ -677,8 +677,8 @@ def update_children_documents_by_query(
@app.task(
bind=True,
autoretry_for=(ConnectionError, NotFoundError),
max_retries=3,
interval_start=5,
max_retries=8,
interval_start=5 * 60,
queue=settings.CELERY_ETL_TASK_QUEUE,
)
@throttle_task(settings.ELASTICSEARCH_THROTTLING_TASK_RATE, key="docket_id")
Expand All @@ -691,7 +691,6 @@ def index_docket_parties_in_es(
:param docket_id: The docket ID to update in ES.
:return: None
"""

docket = Docket.objects.get(id=docket_id)
parties_prepared = DocketDocument().prepare_parties(docket)
fields_to_update = {
Expand Down

0 comments on commit 7ef947a

Please sign in to comment.