@@ -561,7 +561,7 @@ First, you may want to take a look at the project structure and understand what
561561 ├── app # Main application directory.
562562 │ ├── __init__.py # Initialization file for the app package.
563563 │ ├── main.py # Main entry point of the FastAPI application.
564- │ ├── worker.py # Worker script for background tasks.
564+ │ │
565565 │ │
566566 │ ├── api # Folder containing API-related logic.
567567 │ │ ├── __init__.py
@@ -598,11 +598,16 @@ First, you may want to take a look at the project structure and understand what
598598 │ │ │ ├── cache_exceptions.py # Exceptions related to cache operations.
599599 │ │ │ └── http_exceptions.py # HTTP-related exceptions.
600600 │ │ │
601- │ │ └── utils # Utility functions and helpers.
601+ │ │ ├── utils # Utility functions and helpers.
602+ │ │ │ ├── __init__.py
603+ │ │ │ ├── cache.py # Cache-related utilities.
604+ │ │ │ ├── queue.py # Utilities for task queue management.
605+ │ │ │ └── rate_limit.py # Rate limiting utilities.
606+ │ │ │
607+ │ │ └── worker # Worker script for background tasks.
602608 │ │ ├── __init__.py
603- │ │ ├── cache.py # Cache-related utilities.
604- │ │ ├── queue.py # Utilities for task queue management.
605- │ │ └── rate_limit.py # Rate limiting utilities.
609+ │ │ ├── settings.py # Worker configuration and settings.
610+ │ │ └── functions.py # Async task definitions and management.
606611 │ │
607612 │ ├── crud # CRUD operations for the application.
608613 │ │ ├── __init__.py
@@ -1242,7 +1247,7 @@ For `client-side caching`, all you have to do is let the `Settings` class define
12421247
12431248### 5.10 ARQ Job Queues
12441249
1245- Create the background task in ` app/worker.py ` :
1250+ Create the background task in ` app/core/ worker/functions .py ` :
12461251
12471252``` python
12481253...
@@ -1252,7 +1257,7 @@ async def sample_background_task(ctx, name: str) -> str:
12521257 return f " Task { name} is complete! "
12531258```
12541259
1255- Then add the function to the ` WorkerSettings ` class ` functions ` variable:
1260+ Then add the function to the ` WorkerSettings ` class ` functions ` variable in ` app/core/worker/settings.py ` :
12561261
12571262``` python
12581263# -------- class --------
@@ -1288,7 +1293,7 @@ If you are using `docker compose`, the worker is already running.
12881293If you are doing it from scratch, run while in the ` root ` folder:
12891294
12901295``` sh
1291- poetry run arq src.app.worker.WorkerSettings
1296+ poetry run arq src.app.core. worker.settings .WorkerSettings
12921297```
12931298
12941299### 5.11 Rate Limiting
@@ -1469,7 +1474,7 @@ poetry run uvicorn src.app.main:app --reload
14691474And for the worker:
14701475
14711476``` sh
1472- poetry run arq src.app.worker.WorkerSettings
1477+ poetry run arq src.app.core. worker.settings .WorkerSettings
14731478```
14741479
14751480## 6. Running in Production
0 commit comments