fix: make discovery service dependency optional for discussion notifications#37039
fix: make discovery service dependency optional for discussion notifications#37039asajjad2 wants to merge 1 commit intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @asajjad2! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
| """ | ||
| Check if catalog integration is enabled | ||
| """ | ||
| catalog_integration = CatalogIntegration.current() |
There was a problem hiding this comment.
I don't have an issue with this per se, but wouldn't it be clearer to test the setting that enables catalog integration?
There was a problem hiding this comment.
I only found this setting related to catalog existence on which we could place a check COURSE_CATALOG_API_URL. The setting has a default value that's always present even when Discovery isn't running, so checking it alone might incorrectly return True in broken configurations.
The CatalogIntegration.is_enabled() method, on the other hand is consistent with how other catalog functions determine enablement throughout the codebase and also seems to provides proper administrative control through the database.
| ) | ||
| MAX_DURATION = timedelta( | ||
| weeks=getattr(settings, 'COURSE_DURATION_MAX_WEEKS', 18) | ||
| ) |
There was a problem hiding this comment.
Can you clarify in the PR description that MIN_DURATION and MAX_DURATION are currently hard-coded to 4 weeks and 18 weeks respectively, and that this PR makes them configurable?
I feel like this is going to require some input from the product working group, but having this context will help.
There was a problem hiding this comment.
@pdpinch Updated in the additional changes section
bdb9af1 to
d41236d
Compare
|
@asajjad2 can you resolve the conflicts and rebase? I would still like to get a little feedback from the product WG, since this includes adding a setting -- well, actually exposing an existing setting. |
d41236d to
cf92d5e
Compare
|
@mphilbrick211 updated. |
|
@pdpinch hi there! Are you able to review this for us? |
lms/envs/common.py
Outdated
There was a problem hiding this comment.
@asajjad2 I don't think these changes should be here. Maybe they were removed while your PR has been open?
69efda7 to
c8e190c
Compare
242bdd2 to
a2b731c
Compare
Anas12091101
left a comment
There was a problem hiding this comment.
Tested locally. LGTM 👍
a6317cd to
c1b33d2
Compare
|
@asajjad2 can you squash your commits? |
d629985 to
bbcaf2f
Compare
…cations test: patch CatalogIntegration.is_enabled in expiration tests to restore mock behavior test: patch CatalogIntegration.is_enabled in setUp/tearDown feat: make course duration limits configurable refactor: clears ambigous name fix: remove unsued env vars
bbcaf2f to
6b43768
Compare
What are the relevant tickets?
#6471, #6650
Description (What does it do?)
When the Discussions MFE is enabled via the discussions.enable_discussions_mfe Waffle flag, users encounter noisy error logs like:
This error occurs in deployments where the Discovery service (Catalog Integration) is not configured, but the system still attempts to fetch course duration data for notification filtering.
The discussion notification system uses
filter_audit_expired_users_with_no_roleto exclude audit learners whose access has expired. This filtering logic calls:get_expected_duration()to determine course durationget_course_run_details()to fetch weeks_to_complete from Discoverycheck_catalog_integration_and_get_user()which logs an error when Catalog Integration is disabledThis PR modifies
get_expected_duration()in course_date_signals/utils.py to:Additional Changes
This PR also adds configurable Django settings
COURSE_DURATION_MIN_WEEKS(default: 4) andCOURSE_DURATION_MAX_WEEKS(default: 18) to allow deployments to customize course duration bounds without code changes.Current State - The course duration bounds are currently hard-coded as constants:
MIN_DURATION = timedelta(weeks=4)(4 weeks minimum)
MAX_DURATION = timedelta(weeks=18)(18 weeks maximum)
This PR makes these durations configurable through Django settings to allow deployments to customize course duration bounds without code changes:
COURSE_DURATION_MIN_WEEKS(default: 4) - replaces the hard-coded MIN_DURATIONCOURSE_DURATION_MAX_WEEKS(default: 18) - replaces the hard-coded MAX_DURATIONThis change enables deployments to adjust the audit access duration policy to better suit their needs without requiring code modifications.
How can this be tested?