mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 13:12:24 +00:00
Add distributed lock for scheduled task (#732)
* Add distributed lock for scheduled task * Add the task to extend lock * Fix the close
This commit is contained in:
@@ -43,7 +43,8 @@ def init_celery() -> celery.Celery:
|
||||
'group': OVERWRITE_CELERY_RESULT_GROUP_TABLE_NAME,
|
||||
},
|
||||
result_extended=True,
|
||||
# result_expires=0, # 任务结果自动清理,0 或 None 表示不清理
|
||||
# result_expires=0, # 清理任务结果,默认每天凌晨 4 点,0 或 None 表示不清理
|
||||
# beat_sync_every=1, # 保存任务状态周期,默认 3 * 60 秒
|
||||
beat_schedule=LOCAL_BEAT_SCHEDULE,
|
||||
beat_scheduler='backend.app.task.utils.schedulers:DatabaseScheduler',
|
||||
task_cls='backend.app.task.tasks.base:TaskBase',
|
||||
|
||||
Reference in New Issue
Block a user