Background Jobs Dashboard

Here is a list of all our automatic helpers and what they do!

AutoCalculateContestRanksJob
⏱️ Daily at 01:00 AM

Looks at finished games, figures out who won, and gives them coins!

Technical: Processes finished contests, calculates ranks, and awards coins
AutomaticDailyQuizJob
⏱️ Every 15 min

Builds a fresh new quiz for players every single day.

Technical: Generates automatic daily quizzes
BusinessCleanupJob
⏱️ Daily at 03:00 AM

Takes out the trash! Deletes old, messy data to keep everything fast.

Technical: Business data cleanup
DailyJobHealthReportJob
⏱️ Daily at 06:30 AM

The News Reporter. It sends an email every morning summarizing what happened yesterday.

Technical: Sends the daily background job health report email
ExamAndContestInActiveAutoProcessJob
⏱️ Every 30 min

Closes the doors on exams and games that have finished.

Technical: Marks expired exams and contests as inactive
FrequentScheduledNotificationJob
⏱️ Every 15 min

Checks regularly to send out quick reminders.

Technical: Frequent interval-based scheduled notifications
JobFailureMonitorJob
⏱️ Every 1 hour

The Fire Alarm! It checks every hour to see if any job broke, and yells for help if one did.

Technical: Monitors for recently failed jobs and triggers immediate real-time alerts
MissedJobRecoveryJob
⏱️ Daily at 05:00 PM & 07:00 PM

The Safety Net! If a daily or monthly job falls asleep and misses its alarm, this job wakes it up.

Technical: Auto-recovers daily/monthly jobs that missed their scheduled slots
MonthlyPerformanceBatchCreationJob
⏱️ 1st of month at 12:00 AM

Gets ready to collect everyone's monthly scores.

Technical: Creates monthly performance batches for all institutes
MonthlyPerformanceBatchJob
⏱️ 1st of month at 02:00 AM

Gathers up everyone's scores for the month and creates a giant report card.

Technical: Processes all pending monthly performance user logs
MonthlyPerformanceRetryFailedJob
⏱️ 1st of month at 02:30 AM

Double-checks if any monthly score was missed and tries again.

Technical: Retries partially failed monthly performance user logs
NotificationDispatchJob
⏱️ Every 5 min

Sends out text messages and emails that are waiting in line.

Technical: Dispatches pending notifications
ScheduledNotificationJob
⏱️ Daily at 06:00 AM

Wakes up every morning to send out daily reminder emails.

Technical: Generic template-based scheduled notifications
WeeklyPerformanceBatchCreationJob
⏱️ Every Monday at 12:00 AM

Gets ready to collect everyone's weekly scores.

Technical: Creates weekly performance batches for all institutes
WeeklyPerformanceBatchJob
⏱️ Every Monday at 02:00 AM

Gathers up everyone's scores for the week and creates a big report card.

Technical: Processes all pending weekly performance user logs
WeeklyPerformanceRetryFailedJob
⏱️ Every Monday at 02:30 AM

Double-checks if any weekly score was missed and tries again.

Technical: Retries partially failed weekly performance user logs

Hosted Background Services

These are special long-running background services that run continuously outside the TickerQ cron system.

LogCleanupHostedService
⏱️ Daily (24h interval)

Cleans up old application log files older than 15 days to save disk space.

MissedJobRecoveryHostedService
⏱️ Daily at 6:50 AM

Wakes up every morning to trigger the safety net job recovery via TickerQ occurrence checks.

JobLogMissedJobHostedService
⏱️ Daily at 7:10 AM

Scans the Job Execution Logs to detect cron jobs that have no success record today and re-queues them automatically.

TestDailyReportHostedService
⏱️ Daily at 2:00 PM

Wakes up in the afternoon to send out test daily health reports.

How the Safety Net Works (MissedJobRecoveryJob)

This diagram shows how the MissedJobRecoveryJob acts as a safety net for our daily and monthly jobs.

sequenceDiagram participant Time as 🕒 6:00 AM participant DB as Database participant Job as Any Daily/Monthly Job participant SafetyNet as MissedJobRecoveryJob (5 PM & 7 PM) Time->>Job: Wake up! It's time to run! Note over Job: Oh no! The server crashed
and the job never woke up. Time->>SafetyNet: (A bit later) Wake up, Safety Net! SafetyNet->>DB: Hey, did the Daily Job run today? DB-->>SafetyNet: Nope, no record of it! Note over SafetyNet: I better fix this! SafetyNet->>DB: Force the Daily Job to run right NOW! SafetyNet->>Devs: Send an alert: "I saved the day! Daily Job was missed." DB->>Job: WAKE UP! (Forced Run) Job-->>DB: Phew, running now!