Background Jobs¶
[!abstract] Summary Hangfire handles background processing for email delivery, recurring transactions, registration management, and cleanup tasks.
Overview¶
Hangfire provides:
- Background job processing with PostgreSQL persistence
- Scheduled/recurring jobs via CRON expressions
- Automatic retries with exponential backoff
- Dashboard for monitoring (admin only, JWT-authenticated)
Jobs Summary¶
| Job | Default Schedule | Purpose |
|---|---|---|
EmailSendJob | Every 2 min | Process email outbox queue |
ProcessRecurringTransactionsJob | 00:05 daily | Create transactions from recurring templates |
CleanupJob | 23:00 daily | Clean sessions, trash, orphaned files |
ExpireUnconfirmedRegistrationsJob | 05:00 daily | Warn and expire unconfirmed registrations |
PendingUsersReminderJob | 06:00 daily | Remind admins about pending approvals |
EmailSendJob¶
Processes the email outbox queue — fetches pending email tasks, sends via Resend, and implements exponential backoff on failure.
Email types by priority:
- Critical: Password reset
- High: Login with unconfirmed email (auto-resend)
- Normal: Initial registration confirmation
- Low: Email change confirmation
See EmailSendJob implementation for details.
ProcessRecurringTransactionsJob¶
Creates transactions based on recurring templates — fetches enabled recurring transactions within date range and checks frequency (weekly/monthly/yearly) before creating entries.
See ProcessRecurringTransactionsJob implementation for details.
CleanupJob¶
Runs three cleanup tasks with isolated error handling: expired sessions, trash bin (soft-deleted markers), and orphaned files.
See CleanupJob implementation for details.
ExpireUnconfirmedRegistrationsJob¶
Handles the registration expiry workflow — sends warning emails before expiry, then expires overdue registrations.
See ExpireUnconfirmedRegistrationsJob implementation for details.
PendingUsersReminderJob¶
Notifies admins about users awaiting approval — finds users with confirmed email past the notification threshold and sends a digest.
See PendingUsersReminderJob implementation for details.
Configuration¶
Job schedules are configurable in appsettings.json under Hangfire:JobsCron. See Cron Configuration for defaults and available keys. Jobs without cron config default to CronNever (never runs). In development most jobs use this never-run value to avoid unwanted processing.
Dashboard¶
The Hangfire dashboard is available at /hangfire (admin-only). See Dashboard for authentication details.
Related¶
- Authentication — Email confirmation flow
- Authorization — Registration status
- File Storage — Orphaned file cleanup
- Jobs Pattern — Job implementation
- Integrations — Resend email service
- Environment Variables — Job configuration