Skip to content

Commit

Permalink
Fix updates to the course structure in the LMS
Browse files Browse the repository at this point in the history
When we were changing unit titles in the CMS, the changes were taking a
long time to be reflected in the LMS. That's because the cache key that
corresponds to the course structure was not being updated. It was the
responsibility of an asynchronous LMS celery worker to update this cache
entry. However, this was impossible in most cases because tasks
triggered in the CMS were only processed by CMS workers. That is, unless
we are using a custom celery router:
https://celery.readthedocs.io/en/latest/userguide/routing.html#routers

This is what edx-platform does in the devstack: certain CMS tasks are
forwarded both to CMS and to LMS workers. This is achieved by defining
the ALTERNATE_WORKER_QUEUES="lms" django setting in the CMS.

Adding this setting to Tutor solves the problem in production. However,
in development mode Open edX runs without workers
(`CELERY_ALWAYS_EAGER=True`). This means that the course structure will
not be automatically updated when running `tutor dev` commands, which is
a shame. The alternative is to define the
"block_structure.invalidate_cache_on_publish" waffle switch. This can be
done from the UI (in /admin/waffle/switch/add/) or by running:

    tutor dev run lms ./manage.py lms waffle_switch block_structure.invalidate_cache_on_publish on --create

However, this flag seems to slow down access to the LMS for the first
user who tries to access the course after it has been updated.

Close #302
  • Loading branch information
regisb committed Apr 14, 2020
1 parent 30f3923 commit 48ca6eb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

Note: Breaking changes between versions are indicated by "💥".

## Unreleased

- [Bugfix] Fix updates to the course structure in the LMS (#315)

## v3.11.9 (2020-04-07)

- [Bugfix] Fix Android app build for domain names that include a dash ("-")
Expand Down
9 changes: 9 additions & 0 deletions docs/troubleshooting.rst
Expand Up @@ -110,3 +110,12 @@ The chosen default language does not display properly
-----------------------------------------------------

By default, Open edX comes with a `limited set <https://github.com/edx/edx-platform/blob/master/conf/locale/config.yaml>` of translation/localization files. To complement these languages, we add locales from the `openedx-i18n project <https://github.com/openedx/openedx-i18n/blob/master/edx-platform/locale/config-extra.yaml>`_. But not all supported locales are downloaded. In some cases, the chosen default language will not display properly because if was not packaged in either edx-platform or openedx-i18n. If you feel like your language should be packaged, please `open an issue on the openedx-i18n project <https://github.com/openedx/openedx-i18n/issues>`_.

When I make changes to a course in the CMS, they are not taken into account by the LMS
--------------------------------------------------------------------------------------

This issue should only happen in development mode. Long story short, it can be solved by creating a Waffle switch with the following command::
tutor dev run lms ./manage.py lms waffle_switch block_structure.invalidate_cache_on_publish --on --create

If you'd like to learn more, please take a look at `this Github issue <https://github.com/overhangio/tutor/issues/302>`__.
1 change: 1 addition & 0 deletions tutor/templates/apps/openedx/config/cms.env.json
Expand Up @@ -23,6 +23,7 @@
"CELERY_BROKER_HOSTNAME": "{{ RABBITMQ_HOST }}",
"CELERY_BROKER_USER": "{{ RABBITMQ_USERNAME }}",
"CELERY_BROKER_PASSWORD": "{{ RABBITMQ_PASSWORD }}",
"ALTERNATE_WORKER_QUEUES": "lms",
"COMPREHENSIVE_THEME_DIRS": ["/openedx/themes"],
"STATIC_ROOT_BASE": "/openedx/staticfiles",
"ELASTIC_SEARCH_CONFIG": [{
Expand Down

0 comments on commit 48ca6eb

Please sign in to comment.