diff --git a/fbr/__init__.py b/fbr/__init__.py index e69de29..0062f8d 100644 --- a/fbr/__init__.py +++ b/fbr/__init__.py @@ -0,0 +1,7 @@ +from __future__ import absolute_import, unicode_literals + +# This ensures the app is always imported when Django starts +# allowing shared_task to utilize this app. +from .config.celery import celery_app + +__all__ = ("celery_app",) diff --git a/fbr/config/celery.py b/fbr/config/celery.py index 9d13542..1271435 100644 --- a/fbr/config/celery.py +++ b/fbr/config/celery.py @@ -1,3 +1,7 @@ +# isort:skip_file + +from __future__ import absolute_import, unicode_literals + import os from celery import Celery @@ -24,7 +28,7 @@ def setup_periodic_tasks(sender, **kwargs): def get_cache_beat_schedule(): return { "schedule-fbr-cache-task": { - "task": "fbr.cache.tasks.rebuild_cache", + "task": "fbr.tasks.rebuild_cache", "schedule": crontab(hour="1", minute="0"), # Runs daily at 1:00 AM }, } diff --git a/fbr/cache/tasks.py b/fbr/tasks.py similarity index 95% rename from fbr/cache/tasks.py rename to fbr/tasks.py index 096783f..9c16958 100644 --- a/fbr/cache/tasks.py +++ b/fbr/tasks.py @@ -7,7 +7,7 @@ from fbr.search.utils.documents import clear_all_documents -@celery_app.task(name="fbr.cache.tasks.rebuild_cache") +@celery_app.task(name="fbr.tasks.rebuild_cache") def rebuild_cache() -> None: """ Rebuilds the cache for search documents across various components by diff --git a/poetry.lock b/poetry.lock index 48c55ff..ae26841 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2176,13 +2176,13 @@ files = [ [[package]] name = "redis" -version = "5.2.0" +version = "5.2.1" description = "Python client for Redis database and key-value store" optional = false python-versions = ">=3.8" files = [ - {file = "redis-5.2.0-py3-none-any.whl", hash = "sha256:ae174f2bb3b1bf2b09d54bf3e51fbc1469cf6c10aa03e21141f51969801a7897"}, - {file = "redis-5.2.0.tar.gz", hash = "sha256:0b1087665a771b1ff2e003aa5bdd354f15a70c9e25d5a7dbf9c722c16528a7b0"}, + {file = "redis-5.2.1-py3-none-any.whl", hash = "sha256:ee7e1056b9aea0f04c6c2ed59452947f34c4940ee025f5dd83e6a6418b6989e4"}, + {file = "redis-5.2.1.tar.gz", hash = "sha256:16f2e22dff21d5125e8481515e386711a34cbec50f0e44413dd7d9c060a54e0f"}, ] [package.extras] @@ -2545,4 +2545,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "e006eca22e990a307b8c91016df6384b1581fba1619a6284a6758cfbb4220557" +content-hash = "86ba60df7d61e083d24beb4c322ec85edc257e6b25c69a50046b46fdb541dd26" diff --git a/pyproject.toml b/pyproject.toml index 614eecc..b573fdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ kombu = {extras = ["redis"], version = "^5.4.2"} boto3 = "^1.35.71" django-celery-beat = "^2.7.0" django-environ = "^0.11.2" +redis = "^5.2.1" [tool.poetry.group.dev.dependencies] pre-commit = "^3.7.1"