Class: Findbug::CleanupJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Findbug::CleanupJob
- Defined in:
- app/jobs/findbug/cleanup_job.rb
Overview
CleanupJob removes old data based on retention policy.
WHY CLEANUP?
Without cleanup, your database would grow forever:
-
1000 errors/day x 30 days = 30,000 records
-
10000 perf events/day x 30 days = 300,000 records
Cleanup enforces retention policy:
-
Default: 30 days
-
Configurable via config.retention_days
WHAT GETS CLEANED
-
Error events older than retention_days
-
Except: unresolved errors (you probably want to fix these!)
-
-
Performance events older than retention_days
-
All performance data is cleaned (it’s meant for trends, not forever)
-
-
Resolved/ignored errors older than retention_days
SCHEDULING
Run this daily (not too often, not too rare):
findbug_cleanup:
cron: "0 3 * * *" # 3 AM daily
class: Findbug::CleanupJob
Constant Summary collapse
- BATCH_SIZE =
Delete in batches to avoid long-running transactions
1000
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/jobs/findbug/cleanup_job.rb', line 43 def perform return unless Findbug.enabled? cleanup_errors cleanup_performance Findbug.logger.info("[Findbug] Cleanup completed") rescue StandardError => e Findbug.logger.error("[Findbug] CleanupJob failed: #{e.}") raise end |