Skip to content

Commit

Permalink
global: improve legacy import exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: pamfilos <[email protected]>
  • Loading branch information
pamfilos committed Dec 16, 2024
1 parent ed80b8e commit ab6c93c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scoap3/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,14 @@ def upload_index_range(es_settings, search_index, doc_ids, folder_name):
storage = storages["legacy-records"]

for document in documents:
data = document["_source"]
file_name = data["control_number"]
json_data = io.BytesIO(json.dumps(data, ensure_ascii=False).encode("UTF-8"))
storage.save(f"{folder_name}/{file_name}.json", json_data)
try:
data = document["_source"]
file_name = data["control_number"]
json_data = io.BytesIO(json.dumps(data, ensure_ascii=False).encode("UTF-8"))
storage.save(f"{folder_name}/{file_name}.json", json_data)
except Exception as e:
logger.error(f"upload_index_range::error processing document: {e}")
continue


@celery_app.task(acks_late=True)
Expand Down

0 comments on commit ab6c93c

Please sign in to comment.