alumni_lookup

Scheduled Jobs

Last Updated: 2026-01-31
Purpose: Single source of truth for recurring scheduled tasks (Heroku Scheduler)


Heroku Scheduler Limitation

⚠️ Heroku Scheduler only supports: Every 10 minutes, Every hour at…, Every day at…

No weekly option exists. For weekly jobs, schedule DAILY and add a Monday guard in the job code:

return unless Time.zone.today.monday?

Active Schedules

Job Command Schedule (UTC) Notes
Session cleanup rake maintenance:cleanup_sessions Daily at 6:00 AM Removes stale sessions
Message notifications bin/rails runner "MessageNotificationJob.perform_now" Every 10 minutes Sends Champion message email notifications
Champion daily digest bin/rails runner "Cp::NotificationDigestJob.perform_now(digest_type: 'daily')" Daily at 12:00 PM Champion-facing — notification digest for Champions who opted for daily emails
Champion weekly digest bin/rails runner "Cp::NotificationDigestJob.perform_now(digest_type: 'weekly')" Daily at 12:30 PM Champion-facing — notification digest (Monday guard in code)
Staff weekly digest bin/rails runner "Cp::WeeklyDigestJob.perform_now" Daily at 12:30 PM Staff-facing — admin metrics summary (Monday guard in code)
Refresh recommendations bin/rails champion_portal:refresh_recommendations Daily at 8:00 AM Pre-warms “Champions Like Me” cache for dashboard
Seeded questions rake seeded_questions:ensure_coverage QUIET=1 Daily at 6:00 AM Ensures communities have 2 seeded discussion posts (idempotent)

Why Two Weekly Digests?

Job Audience Content
Cp::NotificationDigestJob(weekly) Champions Their personal notifications, unread messages, community activity
Cp::WeeklyDigestJob Staff (portal_admins) Admin metrics: signups, verifications, events, moderation queue

Pending Schedules

None — all scheduled jobs are active.


Timezone Notes


Heroku Scheduler Commands

Via Heroku CLI

Open Scheduler to view/edit jobs:

heroku addons:open scheduler --app alumni-lookup

Testing Jobs Manually

# Test recommendations refresh
heroku run bin/rails champion_portal:refresh_recommendations --app alumni-lookup

# Test seeded questions (ensures coverage, idempotent)
heroku run rake seeded_questions:ensure_coverage --app alumni-lookup

# Check seeded questions status
heroku run rake seeded_questions:stats --app alumni-lookup

# Check seeded questions coverage
heroku run rake seeded_questions:coverage --app alumni-lookup

# Test daily digest
heroku run 'bin/rails runner "Cp::NotificationDigestJob.perform_now(digest_type: \"daily\")"' --app alumni-lookup

# Test weekly digest (will only send on Mondays)
heroku run 'bin/rails runner "Cp::NotificationDigestJob.perform_now(digest_type: \"weekly\")"' --app alumni-lookup

# Test staff weekly digest (will only send on Mondays)
heroku run 'bin/rails runner "Cp::WeeklyDigestJob.perform_now"' --app alumni-lookup

# Force weekly digest on any day (bypass Monday guard - testing only)
heroku run 'bin/rails runner "Cp::NotificationDigestJob.new.send(:send_weekly_digests)"' --app alumni-lookup

How to Update

  1. Open the Heroku Scheduler add-on: heroku addons:open scheduler --app alumni-lookup
  2. Add or update the command + schedule
  3. Update this document to keep the list current