feat: implement automatic database cleanup with cron jobs for events and mirror jobs

This commit is contained in:
Arunavo Ray
2025-05-23 12:15:34 +05:30
parent 3bb85a4cdb
commit 7d32112369
12 changed files with 204 additions and 58 deletions

View File

@@ -153,10 +153,18 @@ bun scripts/check-events.ts
# Clean up old events (default: older than 7 days)
bun scripts/cleanup-events.ts
# Clean up old mirror jobs (default: older than 7 days)
bun scripts/cleanup-mirror-jobs.ts
# Clean up both events and mirror jobs
bun run cleanup-all
# Mark all events as read
bun scripts/mark-events-read.ts
```
When using Docker, database cleanup is automatically scheduled to run daily. You can customize the retention periods by setting the `EVENTS_RETENTION_DAYS` and `JOBS_RETENTION_DAYS` environment variables in your docker-compose file.
### Health Check Endpoint
Gitea Mirror includes a built-in health check endpoint at `/api/health` that provides: