Skip to content

Commit

Permalink
fix typeerror raised when updating single work (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricOuma authored Apr 3, 2024
1 parent 79164e6 commit df19765
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions django_typesense/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ def update_batch(documents_queryset: QuerySet, collection_class, batch_no: int)
if responses is None:
return

failure_responses = [response for response in responses if not response["success"]]

if failure_responses:
raise BatchUpdateError(
f"An Error occurred during the bulk update: {failure_responses}"
)
if isinstance(responses, list):
failure_responses = [
response for response in responses if not response["success"]
]

if failure_responses:
raise BatchUpdateError(
f"An Error occurred during the bulk update: {failure_responses}"
)

logger.debug(f"Batch {batch_no} Updated with {len(collection.data)} records ✓")

Expand Down

0 comments on commit df19765

Please sign in to comment.