Skip to content

Commit 2940aa4

Browse files
committed
update: make celery run task every day by midnight
1 parent d8f4f0f commit 2940aa4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

api/utils/celery_config.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@
99
celery_app.conf.beat_schedule = {
1010
"clean_db_every_day": {
1111
"task": "api.utils.celery_config.clean_expired_and_revoked_tokens_from_sessions_table",
12-
"schedule": crontab(day_of_week=0, hour=0, minute=0)# run every sunday midnight
12+
"schedule": crontab(hour=0, minute=0) # run everyday at midnight
1313
}
1414
}
1515

1616
celery_app.conf.timezone = "UTC"
1717

18+
# Additional configurations
19+
celery_app.conf.update(
20+
task_serializer='json',
21+
result_serializer='json',
22+
accept_content=['json'],
23+
task_acks_late=True,
24+
worker_prefetch_multiplier=1,
25+
task_time_limit=300,
26+
task_soft_time_limit=180,
27+
)
28+
1829
@celery_app.task
1930
def clean_expired_and_revoked_tokens_from_sessions_table():
2031
"""Clean expired and revoked tokens from the sessions table."""

0 commit comments

Comments
 (0)