refactor(tasks): update job scheduling frequency and reduce max hours for old job removal 🔨

This commit is contained in:
2025-07-11 09:53:03 +05:00
parent bb2d0348c2
commit c3fc48fddc
2 changed files with 2 additions and 10 deletions

View File

@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
env.read_env(os.path.join(BASE_DIR, ".env"))
@app.periodic(cron="0 4 * * *")
@app.periodic(cron="0 * * * *") # every 1 hour
@app.task(
queueing_lock="remove_old_jobs",
pass_context=True,
@ -28,19 +28,13 @@ async def remove_old_jobs(context, timestamp):
return await builtin_tasks.remove_old_jobs(
context,
queue="heavy_tasks",
max_hours=24,
max_hours=1,
remove_failed=True,
remove_cancelled=True,
remove_aborted=True,
)
@app.task
def add(x, y):
logger.info(f"Executing test background task with {x} and {y}")
return x + y
@app.periodic(
cron="0 0 */28 * *", queue="heavy_tasks", periodic_id="deactivate_expired_devices"
) # type: ignore