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
from haystack.exceptions import NotHandled
from SciPost_v1.celery import app
from notifications.models import Notification
from submissions.models import Submission
......@@ -73,8 +74,9 @@ class AutoSearchIndexingProcessor(signals.RealtimeSignalProcessor):
pass
def handle_save(self, sender, instance, **kwargs):
sender_type_id = ContentType.objects.get_for_model(sender).id
instance_type_id = ContentType.objects.get_for_model(instance).id
chain = (self.remove_objects_indexes.s(sender_type_id, instance_type_id, instance.id)
| self.update_instance_indexes.s(sender_type_id, instance_type_id, instance.id))
chain()
if not isinstance(instance, Notification):
sender_type_id = ContentType.objects.get_for_model(sender).id
instance_type_id = ContentType.objects.get_for_model(instance).id
chain = (self.remove_objects_indexes.s(sender_type_id, instance_type_id, instance.id)
| 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