Fixes the task to use the correct cache when checking ttl for the featured courses
How can this be tested?
Delete your local featured items :
from django.core.cache import caches
redis_cache.get("CMS_homepage_featured_courses") // should return a list if you have any set
redis_cache = caches["redis"]
redis_cache.delete("CMS_homepage_featured_courses")
redis_cache.get("CMS_homepage_featured_courses") // should return nothing
Wait for the task to run on celery, every minute, at :30. You should see successful output in terminal and running .get again should return a new list
A good next test would be to set ttl for the line to under 10 minutes (so less than 600 seconds) manually, after it has run successfully:
from django.core.cache import caches
redis_cache = caches["redis"]
redis_cache.get("CMS_homepage_featured_courses") // Should return current list. If there are none, can run `cms.api.create_featured_items()`
redis_cache.ttl("CMS_homepage_featured_courses") // should return current value (about 24 hours from now)
redis_cache.expire("CMS_homepage_featured_courses", 300)
redis_cache.ttl("CMS_homepage_featured_courses") // should return a value slightly less than 300
Next time task runs, it should successfully check ttl and run again - changing the output of redis_cache.get("CMS_homepage_featured_courses")
What are the relevant tickets?
Fixes https://github.com/mitodl/hq/issues/4651
Description (What does it do?)
Fixes the task to use the correct cache when checking ttl for the featured courses
How can this be tested?
Delete your local featured items :
Wait for the task to run on celery, every minute, at :30. You should see successful output in terminal and running
.get
again should return a new listA good next test would be to set ttl for the line to under 10 minutes (so less than 600 seconds) manually, after it has run successfully:
Next time task runs, it should successfully check ttl and run again - changing the output of
redis_cache.get("CMS_homepage_featured_courses")