Skip to content

Commit 1c206f1

Browse files
committed
Add celery conf
1 parent bd0b460 commit 1c206f1

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

backend/src/core/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class Settings(BaseSettings):
4646
POSTGRES_PASSWORD: str
4747
POSTGRES_DB: str = ""
4848

49+
CELERY_BROKER_URL: str
50+
CELERY_RESULT_BACKEND: str
51+
4952
@computed_field # type: ignore[misc]
5053
@property
5154
def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn:

backend/src/tasks.py

Whitespace-only changes.

backend/src/worker.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from celery import Celery
2+
3+
from src.core.config import settings
4+
5+
celery = Celery(
6+
"worker",
7+
broker=settings.CELERY_BROKER_URL,
8+
backend=settings.CELERY_RESULT_BACKEND,
9+
)
10+
11+
celery.conf.task_routes = {
12+
"src.tasks.*": {"queue": "default"},
13+
}

0 commit comments

Comments
 (0)