|
10 | 10 | from django.core.cache import cache |
11 | 11 | from django.db import transaction |
12 | 12 | from django.dispatch import receiver |
13 | | -from edx_toggles.toggles import SettingToggle |
14 | 13 | from opaque_keys.edx.keys import CourseKey |
15 | 14 | from openedx_events.content_authoring.data import ( |
16 | 15 | CourseCatalogData, |
@@ -76,21 +75,6 @@ def wrapper(*args, **kwargs): |
76 | 75 | return task_decorator |
77 | 76 |
|
78 | 77 |
|
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 | | - |
94 | 78 | def _create_catalog_data_for_signal(course_key: CourseKey) -> (Optional[datetime], Optional[CourseCatalogData]): |
95 | 79 | """ |
96 | 80 | Creates data for catalog-info-changed signal when course is published. |
@@ -130,12 +114,11 @@ def emit_catalog_info_changed_signal(course_key: CourseKey): |
130 | 114 | """ |
131 | 115 | Given the key of a recently published course, send course data to catalog-info-changed signal. |
132 | 116 | """ |
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) |
139 | 122 |
|
140 | 123 |
|
141 | 124 | @receiver(SignalHandler.course_published) |
|
0 commit comments