Esempio n. 1
0
def trigger_index_update(klass, instance_pk):
    try:
        from celery_haystack.utils import get_update_task
    except ImportError:
        return
    task = get_update_task()
    task.delay('update', get_identifier(klass(id=instance_pk)))
Esempio n. 2
0
def trigger_index_update(klass, instance_pk):
    try:
        from celery_haystack.utils import get_update_task
    except ImportError:
        return
    task = get_update_task()
    task.delay('update', get_identifier(klass(id=instance_pk)))
Esempio n. 3
0
def process_action(action, instance, model):
    # Taken from celery_haystack.signals.CelerySignalProcessor.enqueue
    using_backends = connection_router.for_write(instance=instance)

    for using in using_backends:
        try:
            connection = connections[using]
            index = connection.get_unified_index().get_index(model)
        except NotHandled:
            continue

        if isinstance(index, CelerySearchIndex):
            if action == 'update' and not index.should_update(instance):
                continue
            identifier = get_identifier(instance)
            get_update_task()()(action, identifier)
            break
Esempio n. 4
0
def trigger_index_update(klass, instance_pk):
    task = get_update_task()
    task.delay('update', get_identifier(klass(id=instance_pk)))
Esempio n. 5
0
 def __init__(self, *args, **kwargs):
     super(CelerySearchIndex, self).__init__(*args, **kwargs)
     self.task_cls = get_update_task()
     self.has_get_model = hasattr(self, 'get_model')
Esempio n. 6
0
def trigger_index_update(klass, instance_pk):
    task = get_update_task()
    task.delay('update', get_identifier(klass(id=instance_pk)))
Esempio n. 7
0
 def __init__(self, *args, **kwargs):
     super(CelerySearchIndex, self).__init__(*args, **kwargs)
     self.task_cls = get_update_task()
     self.has_get_model = hasattr(self, 'get_model')