Skip to content

Commit

Permalink
Add more logging (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanderen1 authored Aug 10, 2024
1 parent 4057e7f commit 5110dda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pgsync/search_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _bulk(
):
"""Bulk index, update, delete docs to Elasticsearch/OpenSearch."""
if settings.ELASTICSEARCH_STREAMING_BULK:
for ok, _ in self.streaming_bulk(
for ok, info in self.streaming_bulk(
self.__client,
actions,
index=index,
Expand All @@ -189,10 +189,12 @@ def _bulk(
):
if ok:
self.doc_count += 1
else:
logger.error(f"Document failed to index: {info}")
else:
# parallel bulk consumes more memory and is also more likely
# to result in 429 errors.
for ok, _ in self.parallel_bulk(
for ok, info in self.parallel_bulk(
self.__client,
actions,
thread_count=thread_count,
Expand All @@ -206,6 +208,8 @@ def _bulk(
):
if ok:
self.doc_count += 1
else:
logger.error(f"Document failed to index: {info}")

def refresh(self, indices: t.List[str]) -> None:
"""Refresh the Elasticsearch/OpenSearch index."""
Expand Down

0 comments on commit 5110dda

Please sign in to comment.