Update celery routing for celery 4+ (#25567)

* Update celery routing

- Used routing function instead of class
- Move task queues dictionary to Django settings
- Removed routing_key parameter
- Refactored routing for singleton celery instantiation

Co-authored-by: Awais Qureshi <awais.qureshi@arbisoft.com>
This commit is contained in:
Muhammad Soban Javed
2020-12-16 13:40:47 +05:00
committed by GitHub
parent 958313c6cc
commit bd601cf3a6
21 changed files with 134 additions and 151 deletions

View File

@@ -11,8 +11,7 @@ from edx_django_utils.monitoring import set_code_owner_attribute
from common.djangoapps.entitlements.models import CourseEntitlement
LOGGER = get_task_logger(__name__)
# Under cms the following setting is not defined, leading to errors during tests.
ROUTING_KEY = getattr(settings, 'ENTITLEMENTS_EXPIRATION_ROUTING_KEY', None)
# Maximum number of retries before giving up on awarding credentials.
# For reference, 11 retries with exponential backoff yields a maximum waiting
# time of 2047 seconds (about 30 minutes). Setting this to None could yield
@@ -23,7 +22,6 @@ MAX_RETRIES = 11
@task(
bind=True,
ignore_result=True,
routing_key=ROUTING_KEY,
name='entitlements.expire_old_entitlements',
)
@set_code_owner_attribute