mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 20:54:11 +00:00
feat(cron): Phase 2.6 - Vercel Cron Configuration
Konfiguriert automatische Hintergrund-Jobs für Vercel: - Token-Refresh Cron: 2x täglich (6:00 + 18:00 UTC) - Erneuert OAuth-Tokens 7 Tage vor Ablauf - Benachrichtigt Manager bei Problemen - Dokumentation in CLAUDE.md: - Neue Sektion "Scheduled Cron Jobs (Vercel)" - Übersicht aller Cron-Endpoints - Beispiele für manuellen Trigger - Monitoring-Hinweise Bestehende Crons: - community-sync: alle 15 Minuten (YouTube/Facebook/Instagram) - token-refresh: 2x täglich (OAuth Token Renewal) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cdaa871436
commit
7774616f00
2 changed files with 38 additions and 0 deletions
34
CLAUDE.md
34
CLAUDE.md
|
|
@ -1114,6 +1114,40 @@ pnpm test:coverage
|
|||
- Functions: 50%
|
||||
- Branches: 65%
|
||||
|
||||
## Scheduled Cron Jobs (Vercel)
|
||||
|
||||
Automatische Hintergrund-Jobs via Vercel Cron (`vercel.json`):
|
||||
|
||||
| Endpoint | Schedule | Beschreibung |
|
||||
|----------|----------|--------------|
|
||||
| `/api/cron/community-sync` | `*/15 * * * *` (alle 15 Min) | Synchronisiert Kommentare von YouTube, Facebook, Instagram |
|
||||
| `/api/cron/token-refresh` | `0 6,18 * * *` (6:00 + 18:00 UTC) | Erneuert ablaufende OAuth-Tokens automatisch |
|
||||
|
||||
**Authentifizierung:**
|
||||
Alle Cron-Endpoints erfordern `Authorization: Bearer $CRON_SECRET` Header.
|
||||
|
||||
**Manueller Trigger:**
|
||||
```bash
|
||||
# Community Sync manuell auslösen
|
||||
curl -X POST "https://your-domain/api/cron/community-sync" \
|
||||
-H "Authorization: Bearer $CRON_SECRET" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"platforms": ["youtube", "facebook"]}'
|
||||
|
||||
# Token Refresh manuell auslösen (Dry-Run)
|
||||
curl "https://your-domain/api/cron/token-refresh?dryRun=true" \
|
||||
-H "Authorization: Bearer $CRON_SECRET"
|
||||
|
||||
# Token Refresh Status prüfen
|
||||
curl -I "https://your-domain/api/cron/token-refresh" \
|
||||
-H "Authorization: Bearer $CRON_SECRET"
|
||||
```
|
||||
|
||||
**Monitoring:**
|
||||
- HEAD-Requests geben Status-Header zurück (`X-Sync-Running`, `X-Last-Run`, etc.)
|
||||
- Bei laufendem Job: HTTP 423 (Locked)
|
||||
- Fehlerhafte Tokens werden als Benachrichtigungen in `yt-notifications` gespeichert
|
||||
|
||||
## CI/CD Pipeline
|
||||
|
||||
GitHub Actions Workflows in `.github/workflows/`:
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
{
|
||||
"path": "/api/cron/community-sync",
|
||||
"schedule": "*/15 * * * *"
|
||||
},
|
||||
{
|
||||
"path": "/api/cron/token-refresh",
|
||||
"schedule": "0 6,18 * * *"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue