Skip to content

Commit

Permalink
Disable celery autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Sep 30, 2022
1 parent 20906a3 commit 2abab42
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions kobo/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
class KpiConfig(AppConfig):
name = 'kpi'

def ready(self, *args, **kwargs):
# Register signals only when the app is ready to avoid issues with models
# not loaded yet.
import kpi.signals
# def ready(self, *args, **kwargs):
# # Register signals only when the app is ready to avoid issues with models
# # not loaded yet.
# import kpi.signals

# Once it's okay to read from the database, apply the user-desired
# autoscaling configuration for Celery workers
from kobo.celery import update_concurrency_from_constance
try:
# Push this onto the task queue with `delay()` instead of calling
# it directly because a direct call in the absence of any Celery
# workers hangs indefinitely
update_concurrency_from_constance.delay()
except kombu.exceptions.OperationalError as e:
# It's normal for Django to start without access to a message
# broker, e.g. while running `./manage.py collectstatic`
# during a Docker image build
pass
return super().ready(*args, **kwargs)
# # Once it's okay to read from the database, apply the user-desired
# # autoscaling configuration for Celery workers
# from kobo.celery import update_concurrency_from_constance
# try:
# # Push this onto the task queue with `delay()` instead of calling
# # it directly because a direct call in the absence of any Celery
# # workers hangs indefinitely
# update_concurrency_from_constance.delay()
# except kombu.exceptions.OperationalError as e:
# # It's normal for Django to start without access to a message
# # broker, e.g. while running `./manage.py collectstatic`
# # during a Docker image build
# pass
# return super().ready(*args, **kwargs)


register(TwoDatabaseConfigurationChecker().as_check(), Tags.database)

0 comments on commit 2abab42

Please sign in to comment.