Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readthedocs/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def cleanup_pidbox_keys():
https://github.com/readthedocs/readthedocs-ops/issues/1260

"""
client = redis.from_url(settings.BROKER_URL)
client = redis.from_url(settings.CELERY_BROKER_URL)
keys = client.keys("*reply.celery.pidbox*")
total_memory = 0
for key in keys:
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/utils/tasks/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"TaskNoPermission",
)

STATUS_UPDATES_ENABLED = not settings.CELERY_ALWAYS_EAGER
STATUS_UPDATES_ENABLED = not settings.CELERY_TASK_ALWAYS_EAGER


# pylint: disable=abstract-method
Expand Down
24 changes: 12 additions & 12 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,26 +656,26 @@ def BUILD_MEMORY_LIMIT(self):

# Celery
CELERY_APP_NAME = "readthedocs"
CELERY_ALWAYS_EAGER = True
CELERYD_TASK_TIME_LIMIT = 60 * 60 # 60 minutes
CELERY_SEND_TASK_ERROR_EMAILS = False
CELERY_IGNORE_RESULT = True
CELERYD_HIJACK_ROOT_LOGGER = False
CELERY_TASK_ALWAYS_EAGER = True
CELERY_TASK_TIME_LIMIT = 60 * 60 # 60 minutes
CELERY_TASK_SEND_ERROR_EMAILS = False
CELERY_TASK_IGNORE_RESULT = True
CELERY_WORKER_HIJACK_ROOT_LOGGER = False
# This stops us from pre-fetching a task that then sits around on the builder
CELERY_ACKS_LATE = True
CELERY_TASK_ACKS_LATE = True
# Don't queue a bunch of tasks in the workers
CELERYD_PREFETCH_MULTIPLIER = 1
CELERY_CREATE_MISSING_QUEUES = True
CELERY_WORKER_PREFETCH_MULTIPLIER = 1
CELERY_TASK_CREATE_MISSING_QUEUES = True

# https://github.com/readthedocs/readthedocs.org/issues/12317#issuecomment-3070950434
# https://docs.celeryq.dev/en/stable/getting-started/backends-and-brokers/redis.html#visibility-timeout
BROKER_TRANSPORT_OPTIONS = {
CELERY_BROKER_TRANSPORT_OPTIONS = {
'visibility_timeout': 18000, # 5 hours
}

CELERY_DEFAULT_QUEUE = "celery"
CELERYBEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
CELERYBEAT_SCHEDULE = {
CELERY_TASK_DEFAULT_QUEUE = "celery"
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
CELERY_BEAT_SCHEDULE = {
"every-minute-finish-unhealthy-builds": {
"task": "readthedocs.projects.tasks.utils.finish_unhealthy_builds",
"schedule": crontab(minute="*"),
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/settings/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def DATABASES(self): # noqa
},
}

BROKER_URL = f"redis://:redispassword@cache:6379/0"
CELERY_BROKER_URL = f"redis://:redispassword@cache:6379/0"

CELERY_ALWAYS_EAGER = False
CELERY_TASK_ALWAYS_EAGER = False

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CommunityTestSettings(CommunityBaseSettings):
ELASTICSEARCH_DSL_AUTOSYNC = False
ELASTICSEARCH_DSL_AUTO_REFRESH = True

CELERY_ALWAYS_EAGER = True
CELERY_TASK_ALWAYS_EAGER = True

# Skip automatic detection of Docker limits for testing
BUILD_TIME_LIMIT = 600
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def create_application():
)

application = Celery(settings.CELERY_APP_NAME)
application.config_from_object("django.conf:settings")
application.config_from_object("django.conf:settings", namespace="CELERY")
application.autodiscover_tasks(None)

# A step to initialize django-structlog
Expand Down