mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-24 17:48:41 +02:00
feat(tasks): add error logging
This commit is contained in:
@@ -1,14 +1,26 @@
|
||||
import logging
|
||||
|
||||
from procrastinate import builtin_tasks
|
||||
from procrastinate.contrib.django import app
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@app.periodic(cron="0 4 * * *")
|
||||
@app.task(queueing_lock="remove_old_jobs", pass_context=True)
|
||||
async def remove_old_jobs(context, timestamp):
|
||||
return await builtin_tasks.remove_old_jobs(
|
||||
context,
|
||||
max_hours=744,
|
||||
remove_error=True,
|
||||
remove_cancelled=True,
|
||||
remove_aborted=True,
|
||||
)
|
||||
try:
|
||||
return await builtin_tasks.remove_old_jobs(
|
||||
context,
|
||||
max_hours=744,
|
||||
remove_error=True,
|
||||
remove_cancelled=True,
|
||||
remove_aborted=True,
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
"Error while executing 'remove_old_jobs' task",
|
||||
exc_info=True,
|
||||
)
|
||||
raise e
|
||||
|
||||
Reference in New Issue
Block a user