mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-07 12:16:30 +00:00
feat(tasks): integrate procrastinate app and configure on_app_ready callback ✨
This commit is contained in:
14
api/tasks_app.py
Normal file
14
api/tasks_app.py
Normal file
@ -0,0 +1,14 @@
|
||||
# projects/tasks_app.py
|
||||
from procrastinate import App
|
||||
from procrastinate.contrib.django import django_connector
|
||||
|
||||
app = App(
|
||||
connector=django_connector.DjangoConnector(),
|
||||
periodic_defaults={"max_delay": 86400}, # accept up to 24h delay
|
||||
)
|
||||
|
||||
|
||||
def on_app_ready(app):
|
||||
app.periodic_defaults = {"max_delay": 86400}
|
||||
app.import_paths.append("api.tasks")
|
||||
app.import_paths.append("billing.tasks")
|
@ -371,8 +371,5 @@ PASSWORDLESS_AUTH = {
|
||||
}
|
||||
|
||||
|
||||
# CELERY CONFIGURATION
|
||||
CELERY_BROKER_URL = f"redis://{REDIS_HOST}:6379/0"
|
||||
CELERY_ACCEPT_CONTENT = ["json"]
|
||||
CELERY_TASK_SERIALIZER = "json"
|
||||
CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:6379/0"
|
||||
PROCRASTINATE_ON_APP_READY = "api.tasks_app.on_app_ready"
|
||||
PROCRASTINATE_APP = "api.tasks_app.app"
|
||||
|
Reference in New Issue
Block a user