feat(scheduler): in-process matching scheduler with audit + admin endpoints

- Add in-process scheduler service triggered by ENABLE_SCHEDULER
- Record runs in new matching_runs table; throttle per-event and log stats
- Add admin endpoints: POST /api/admin/events/:slug/run-now and GET /api/admin/events/:slug/matching-runs
- Wire scheduler start/stop in server and add ENV flags + compose defaults
- Prisma schema: add MatchingRun model and relation
- Update env examples for scheduler configuration
This commit is contained in:
Radosław Gierwiało
2025-11-30 13:14:02 +01:00
parent a110ddb6a6
commit 537dd112ff
9 changed files with 338 additions and 11 deletions

View File

@@ -50,3 +50,11 @@ LOCKOUT_DURATION_MINUTES=15
# Logging
LOG_LEVEL=warn
# Scheduler
# Enable simple in-process scheduler for auto-matching (enable on exactly one replica)
ENABLE_SCHEDULER=false
# Global tick interval in seconds (e.g., 300 = 5min)
SCHEDULER_INTERVAL_SEC=300
# Per-event minimum time between runs in seconds to avoid thrashing
MATCHING_MIN_INTERVAL_SEC=120