From 5660c221b7660a9c9b7e8379c5b404e309f2aeb3 Mon Sep 17 00:00:00 2001 From: Joe Farrelly Date: Tue, 30 Jun 2026 21:59:14 +0100 Subject: [PATCH] Schedule fullDataScan weekly via Celery Beat Runs every Sunday 03:00 UTC alongside the existing daily purge_stale_profiles schedule. The admin-triggered datascan endpoints are kept for ad-hoc manual scans. --- CLAUDE.md | 4 ++++ backend/settings.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 7e05e2a..ccd2cfc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -145,6 +145,10 @@ Picks the highest-level, highest-ilvl alt per faction (Alliance + Horde) and fet ### Data scan (`fullDataScan` Celery task) Dispatches six independent subtasks: `scanProfessionData`, `scanMountData`, `scanPetData`, `scanAchievementData`, `scanFactionData`, `scanMythicDungeonData`. Each can also be triggered individually via its own endpoint. The dungeon index requires `namespace=dynamic-eu` (not `static-eu` like other catalogs). +### Scheduled tasks (`CELERY_BEAT_SCHEDULE` in `settings.py`) +- `purge_stale_profiles` — daily, deletes expired profile records. +- `fullDataScan` — weekly, Sunday 03:00 UTC, with `BLIZZ_CLIENT`/`BLIZZ_SECRET` baked into the schedule args at startup. The admin-triggered `/api/custom/datascan/` endpoints still work for ad-hoc/manual scans (e.g. testing a single category). + ### Lua addon file `ProfileUser.perform_update` validates and stores a `FazzToolsScraper.lua` addon export. `ProfileUserView.list` with `?page=header` returns the last-update timestamp; the file is parsed via `LuaParser` and cached on read (`userfile:{user_id}`), ready for future addon-only data (gold, currencies, lockouts) to consume — no page handler reads it yet. diff --git a/backend/settings.py b/backend/settings.py index 5fa0e97..43f4a1c 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -1,6 +1,7 @@ from pathlib import Path import environ +from celery.schedules import crontab env = environ.Env() environ.Env.read_env() @@ -111,6 +112,11 @@ "task": "apicore.tasks.purge_stale_profiles", "schedule": 86400, }, + "full-data-scan-weekly": { + "task": "apicore.tasks.fullDataScan", + "schedule": crontab(day_of_week="sunday", hour=3, minute=0), + "args": (env("BLIZZ_CLIENT"), env("BLIZZ_SECRET")), + }, } REST_FRAMEWORK = {