Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/apps/mentorship/signals/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .program import ProgramPostSaveHandler
from .program import program_post_save_clear_algolia_cache
19 changes: 8 additions & 11 deletions backend/apps/mentorship/signals/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@
logger = logging.getLogger(__name__)


class ProgramPostSaveHandler:
"""Handles post_save signal for Program model to clear Algolia cache."""

@receiver(post_save, sender=Program)
def program_post_save_clear_algolia_cache(sender, instance, **kwargs): # noqa: N805
"""Signal handler to clear Algolia cache for the Program index.

The sender, instance, and kwargs arguments are provided by the post_save signal.
"""
logger.info("Signal received for program '%s'. Clearing 'programs' index.", instance.name)
clear_index_cache("programs")
@receiver(post_save, sender=Program)
def program_post_save_clear_algolia_cache(_sender, instance, **_kwargs):
"""Signal handler to clear Algolia cache for the Program index.

The sender, instance, and kwargs arguments are provided by the post_save signal.
"""
logger.info("Signal received for program '%s'. Clearing 'programs' index.", instance.name)
clear_index_cache("programs")
Loading