Class: BrainMaintenanceWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/brain_maintenance_worker.rb

Overview

Daily autonomous pruning of the Sunny brain + a digest email.

Prunes ONLY — auto-rejects ephemeral junk from the pending queue and
auto-applies BrainCompactor's archive / tighten / consolidate over the active
set (reversible via PaperTrail). It never auto-approves: legit pending rules
are surfaced in the digest for a human to approve.

Scheduled ~5 AM Central via config/sidekiq_production_schedule.yml.

Instance Method Summary collapse

Instance Method Details

#performObject

Runs the job.

Returns:

  • (Object)

    the result



19
20
21
22
23
24
# File 'app/workers/brain_maintenance_worker.rb', line 19

def perform
  summary = Assistant::BrainMaintenance.run!
  return unless summary.success? && summary.reportable?

  BrainMaintenanceMailer.daily_digest(summary).deliver_now
end