Skip to content

Commit 109f5e0

Browse files
authored
Merge pull request #37269 from openedx/feanil/remove_unnecssary_toggle
feat: Remove the `SEND_CATALOG_INFO_SIGNAL` toggle
2 parents 80e6e12 + 47efb29 commit 109f5e0

3 files changed

Lines changed: 5 additions & 33 deletions

File tree

cms/djangoapps/contentstore/signals/handlers.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from django.core.cache import cache
1111
from django.db import transaction
1212
from django.dispatch import receiver
13-
from edx_toggles.toggles import SettingToggle
1413
from opaque_keys.edx.keys import CourseKey
1514
from openedx_events.content_authoring.data import (
1615
CourseCatalogData,
@@ -76,21 +75,6 @@ def wrapper(*args, **kwargs):
7675
return task_decorator
7776

7877

79-
# .. toggle_name: SEND_CATALOG_INFO_SIGNAL
80-
# .. toggle_implementation: SettingToggle
81-
# .. toggle_default: False
82-
# .. toggle_description: When True, sends to catalog-info-changed signal when course_published occurs.
83-
# This is a temporary toggle to allow us to test the event bus integration; it should be removed and
84-
# always-on once the integration is well-tested and the error cases are handled. (This is separate
85-
# from whether the event bus itself is configured; if this toggle is on but the event bus is not
86-
# configured, we should expect a warning at most.)
87-
# .. toggle_use_cases: temporary
88-
# .. toggle_creation_date: 2022-08-22
89-
# .. toggle_target_removal_date: 2022-10-30
90-
# .. toggle_tickets: https://github.com/openedx/edx-platform/issues/30682
91-
SEND_CATALOG_INFO_SIGNAL = SettingToggle('SEND_CATALOG_INFO_SIGNAL', default=False, module_name=__name__)
92-
93-
9478
def _create_catalog_data_for_signal(course_key: CourseKey) -> (Optional[datetime], Optional[CourseCatalogData]):
9579
"""
9680
Creates data for catalog-info-changed signal when course is published.
@@ -130,12 +114,11 @@ def emit_catalog_info_changed_signal(course_key: CourseKey):
130114
"""
131115
Given the key of a recently published course, send course data to catalog-info-changed signal.
132116
"""
133-
if SEND_CATALOG_INFO_SIGNAL.is_enabled():
134-
timestamp, catalog_info = _create_catalog_data_for_signal(course_key)
135-
if catalog_info is not None:
136-
# .. event_implemented_name: COURSE_CATALOG_INFO_CHANGED
137-
# .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1
138-
COURSE_CATALOG_INFO_CHANGED.send_event(time=timestamp, catalog_info=catalog_info)
117+
timestamp, catalog_info = _create_catalog_data_for_signal(course_key)
118+
if catalog_info is not None:
119+
# .. event_implemented_name: COURSE_CATALOG_INFO_CHANGED
120+
# .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1
121+
COURSE_CATALOG_INFO_CHANGED.send_event(time=timestamp, catalog_info=catalog_info)
139122

140123

141124
@receiver(SignalHandler.course_published)

cms/djangoapps/contentstore/signals/tests/test_handlers.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from datetime import datetime, timezone
66
from unittest.mock import patch
77

8-
from django.test.utils import override_settings
98
from opaque_keys.edx.locator import CourseLocator, LibraryLocator
109
from openedx_events.content_authoring.data import CourseCatalogData, CourseScheduleData
1110

@@ -60,7 +59,6 @@ def test_signal_chain(self, mock_emit, _mock_on_commit):
6059
SignalHandler.course_published.send(TestCatalogInfoSignal, course_key=self.course_key)
6160
mock_emit.assert_called_once_with(self.course_key)
6261

63-
@override_settings(SEND_CATALOG_INFO_SIGNAL=True)
6462
@patch('cms.djangoapps.contentstore.signals.handlers.COURSE_CATALOG_INFO_CHANGED', autospec=True)
6563
def test_emit_regular_course(self, mock_signal):
6664
"""On a normal course publish, send an event."""
@@ -71,16 +69,8 @@ def test_emit_regular_course(self, mock_signal):
7169
time=now.replace(tzinfo=timezone.utc),
7270
catalog_info=self.expected_data)
7371

74-
@override_settings(SEND_CATALOG_INFO_SIGNAL=True)
7572
@patch('cms.djangoapps.contentstore.signals.handlers.COURSE_CATALOG_INFO_CHANGED', autospec=True)
7673
def test_ignore_library(self, mock_signal):
7774
"""When course key is actually a library, don't send."""
7875
sh.emit_catalog_info_changed_signal(LibraryLocator(org='SomeOrg', library='stuff'))
7976
mock_signal.send_event.assert_not_called()
80-
81-
@override_settings(SEND_CATALOG_INFO_SIGNAL=False)
82-
@patch('cms.djangoapps.contentstore.signals.handlers.COURSE_CATALOG_INFO_CHANGED', autospec=True)
83-
def test_disabled(self, mock_signal):
84-
"""When toggle is disabled, don't send."""
85-
sh.emit_catalog_info_changed_signal(self.course_key)
86-
mock_signal.send_event.assert_not_called()

cms/envs/mock.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,6 @@ RETIREMENT_STATES:
705705
- COMPLETE
706706
SECRET_KEY: test_secret_key
707707
SEGMENT_KEY: test_segment_key
708-
SEND_CATALOG_INFO_SIGNAL: true
709708
SERVER_EMAIL: [email protected]
710709
SESSION_COOKIE_NAME: studio_sessionid
711710
SESSION_COOKIE_SECURE: true

0 commit comments

Comments
 (0)