SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit e31dbc30 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Remove notifications from reindex trigger

parent 5e04c032
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ from haystack import signals ...@@ -8,6 +8,7 @@ from haystack import signals
from haystack.exceptions import NotHandled from haystack.exceptions import NotHandled
from SciPost_v1.celery import app from SciPost_v1.celery import app
from notifications.models import Notification
from submissions.models import Submission from submissions.models import Submission
...@@ -73,8 +74,9 @@ class AutoSearchIndexingProcessor(signals.RealtimeSignalProcessor): ...@@ -73,8 +74,9 @@ class AutoSearchIndexingProcessor(signals.RealtimeSignalProcessor):
pass pass
def handle_save(self, sender, instance, **kwargs): def handle_save(self, sender, instance, **kwargs):
sender_type_id = ContentType.objects.get_for_model(sender).id if not isinstance(instance, Notification):
instance_type_id = ContentType.objects.get_for_model(instance).id sender_type_id = ContentType.objects.get_for_model(sender).id
chain = (self.remove_objects_indexes.s(sender_type_id, instance_type_id, instance.id) instance_type_id = ContentType.objects.get_for_model(instance).id
| self.update_instance_indexes.s(sender_type_id, instance_type_id, instance.id)) chain = (self.remove_objects_indexes.s(sender_type_id, instance_type_id, instance.id)
chain() | self.update_instance_indexes.s(sender_type_id, instance_type_id, instance.id))
chain()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment