from django.dispatch import receiver

from ocyan.core.signals import post_loaddemodata

from .spooler import update_oscar_index as update_oscar_index_async


@receiver(post_loaddemodata)
def update_oscar_index(has_unloaded_fixtures, **kwargs):  # pylint: disable=W0613
    if has_unloaded_fixtures:
        update_oscar_index_async.spool()
