-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
If a save signal is fired and the model instance had not been indexed, this error occured
How To Reproduce
Steps to reproduce the behavior:
- Create a model instance (disable the signals from firing to simulate case where indexing is not done) using .create
- Retrieve the instance and call .save on it
Expected behavior
ObjectNotFound: [Errno 404] Could not find a document with id: 115554
File "django_typesense/collections.py", line 357, in _update_single_document
.update(document)
File "typesense/document.py", line 17, in update
return self.api_call.patch(self._endpoint_path(), document, params)
File "typesense/api_call.py", line 154, in patch
return self.make_request(requests.patch, endpoint, True,
File "typesense/api_call.py", line 116, in make_request
raise ApiCall.get_exception(r.status_code)(r.status_code, error_message)
ServerError: [Errno 500] Unhandled Typesense error in index batch, check logs for details.
File "celery/app/trace.py", line 760, in protected_call
return self.run(*args, **kwargs)
File "apps/common/models.py", line 102, in save
super().save(*args, **kwargs)
File "django/db/models/base.py", line 814, in save
self.save_base(
File "django/db/models/base.py", line 892, in save_base
post_save.send(
File "django/dispatch/dispatcher.py", line 176, in send
return [
File "django/dispatch/dispatcher.py", line 177, in
(receiver, receiver(signal=self, sender=sender, **named))
File "django_typesense/signals.py", line 12, in post_save_typesense_models
sender.get_collection(instance, update_fields=kwargs.get('update_fields', [])).update()
File "django_typesense/collections.py", line 346, in update
return self._update_single_document(self.data[0])
File "django_typesense/collections.py", line 362, in _update_single_document
return client.collections[self.schema_name].documents.upsert(
File "typesense/documents.py", line 44, in upsert
return self.api_call.post(self._endpoint_path(), document, params)
File "typesense/api_call.py", line 144, in post
return self.make_request(requests.post, endpoint, as_json,
File "typesense/api_call.py", line 130, in make_request
raise last_exception
File "typesense/api_call.py", line 116, in make_request
raise ApiCall.get_exception(r.status_code)(r.status_code, error_message)
Environment Details (please complete the following information)
-
OS: [e.g. Ubuntu 22.04]
-
Versions:
- Python: [e.g. 3.10]
- Django: [e.g. 4.2]
- django_typesense: [e.g. 0.1.3]
Additional context
Add any other context about the problem here.
Screenshots
If applicable, add screenshots to help explain your problem.