Create dedicated queue for time-sensitive notifications
Problem
Currently, notification jobs are scattered across multiple queues with varying priorities:
Existing notification queues:
-
monthly_notification
(weight 2): Monthly seat usage digests -
mailers
(weight 2): General email delivery - Various queues contain notification jobs mixed with other operations
Issues with current setup:
- Time-sensitive notifications (trial expiration, payment failures) compete with scheduled digests
- No clear distinction between urgent vs. routine notifications
- Difficult to monitor and optimize notification delivery separately
Examples of time-sensitive notifications:
- Trial expiration warnings (should be immediate)
- Payment failure alerts (revenue-impacting)
- License delivery notifications (customer-blocking)
- Reconciliation alerts (time-bound)
Proposal
Create a dedicated high-priority queue for urgent, time-sensitive notifications.
New Queue Structure
notifications_urgent
(weight 7-8)
Purpose: Time-sensitive, customer-impacting notifications that should be delivered immediately
Jobs to move here:
- License delivery notifications (from
gitlab
queue) - Trial expiration warnings (from
expiration
queue) - Payment failure alerts
- Reconciliation deadline notifications
- Any notification where delay impacts customer experience
Keep monthly_notification
(weight 3)
Purpose: Scheduled digest emails that can tolerate some delay
Jobs that stay here:
SeatsUsageMonthlyNotificationJob
- Monthly usage reports
- Periodic summary emails
Keep mailers
(weight 3)
Purpose: General transactional emails
Jobs that stay here:
- Order confirmations
- Account updates
- General customer communications
Benefits
- Better customer experience: Urgent notifications delivered promptly
- Clear prioritization: Explicit distinction between urgent and routine
- Improved monitoring: Can track urgent notification delivery separately
- Reduced risk: Payment and expiration alerts won't be delayed by digest emails
Implementation Steps
-
Identify all notification jobs:
- Audit codebase for mailer jobs
- Categorize by urgency and customer impact
- Document current queue assignments
-
Create new queue:
# app/jobs/notifications/urgent_base_job.rb module Notifications class UrgentBaseJob < ApplicationJob queue_as :notifications_urgent # Common configuration for urgent notifications end end
-
Update job classes:
# Example: License notification class LicenseNotificationJob < Notifications::UrgentBaseJob def perform(subscription_id) # Send license email end end
-
Update
config/sidekiq.yml
::queues: # ... other queues ... - [notifications_urgent, 8] # ... other queues ... - [monthly_notification, 3] - [mailers, 3]
-
Add monitoring:
- Alert on queue depth for
notifications_urgent
- Track delivery latency for urgent notifications
- Monitor failure rates
- Alert on queue depth for
-
Document guidelines:
- When to use
notifications_urgent
vs.mailers
- SLA expectations for each notification queue
- Examples of urgent vs. routine notifications
- When to use
Examples of Queue Assignment
Use notifications_urgent
:
-
✅ Trial expires in 24 hours -
✅ Payment method failed -
✅ License ready for download -
✅ Reconciliation due in 7 days -
✅ Subscription cancelled (immediate impact)
Use monthly_notification
:
-
✅ Monthly seat usage digest -
✅ Quarterly usage summary -
✅ Monthly invoice available
Use mailers
:
-
✅ Order confirmation -
✅ Account settings changed -
✅ Password reset -
✅ General announcements
Success Criteria
- All time-sensitive notifications identified and moved to new queue
- Urgent notifications delivered within 1 minute of enqueue (P95)
- No customer complaints about delayed critical notifications
- Clear documentation for future notification jobs