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

@@ -112,6 +112,10 @@ services:
environment:
- NODE_ENV=development
- PORT=3000
# Scheduler (enable for a single backend instance)
- ENABLE_SCHEDULER=true
- SCHEDULER_INTERVAL_SEC=300
- MATCHING_MIN_INTERVAL_SEC=60
# Security: Relaxed for development
- RATE_LIMIT_ENABLED=false
- RATE_LIMIT_AUTH_MAX=100
@@ -141,6 +145,10 @@ services:
environment:
- NODE_ENV=production
- PORT=3000
# Scheduler (enable on exactly one replica)
- ENABLE_SCHEDULER=false
- SCHEDULER_INTERVAL_SEC=300
- MATCHING_MIN_INTERVAL_SEC=120
# Security: Strict for production (override with .env file)
- RATE_LIMIT_ENABLED=true
- RATE_LIMIT_AUTH_MAX=5