Scheduled Jobs and Background Processing
The problem: manual maintenance does not scale
Section titled βThe problem: manual maintenance does not scaleβA content management system accumulates work that nobody wants to do by hand. Expired content needs unpublishing. Search indexes need rebuilding after bulk imports. Broken links need detecting before visitors find them. Trash bins need emptying.
Doing these tasks manually wastes time and invites mistakes. Optimizely CMS handles them through scheduled jobs β background tasks that run automatically on a defined schedule.
What scheduled jobs are
Section titled βWhat scheduled jobs areβA scheduled job is a unit of work that the CMS executes in the background. Each job has a name, a schedule (how often it runs), and a task (what it does). Jobs run independently of user requests. They do not block the editor interface or affect page delivery.
You can think of scheduled jobs as cron tasks built into the CMS. They run at intervals you define, perform their work, and report success or failure in the admin interface.
Built-in scheduled jobs
Section titled βBuilt-in scheduled jobsβOptimizely CMS ships with several jobs that handle common maintenance needs:
| Job name | What it does | Why it matters |
|---|---|---|
| Publish Delayed Content | Publishes content items that have a future publish date | Enables scheduled publishing workflows |
| Remove Abandoned BLOBs | Cleans up orphaned binary files (images, documents) | Prevents storage bloat |
| Remove Permanent Editing | Clears stale content locks from crashed sessions | Prevents editors from being locked out |
| Subscription Notification | Sends email notifications for content changes | Keeps stakeholders informed |
| Clear Thumbnail Properties | Regenerates content thumbnails | Fixes broken previews after migrations |
| Link Validation | Scans content for broken internal and external links | Catches dead links before visitors do |
| Trash Empty | Permanently removes items in the trash | Reclaims storage space |
| Notification Dispatcher | Processes queued notification messages | Delivers assignment and approval alerts |
Not every built-in job needs to run. Disable jobs you do not use to reduce background processing overhead.
Configuring job schedules
Section titled βConfiguring job schedulesβEach scheduled job has three scheduling options:
- Interval β Run every N minutes, hours, or days
- Time of day β Run at a specific time daily
- Manual only β Only run when an administrator triggers it
Set intervals based on urgency. Link validation can run weekly. Publish Delayed Content should run every few minutes so scheduled posts go live on time.
Running jobs manually
Section titled βRunning jobs manuallyβSometimes you need a job to run immediately. After a large content import, you might want to trigger search reindexing right away instead of waiting for the next scheduled run. The admin interface lets you start any job manually with a single click.
SaaS vs PaaS: different levels of control
Section titled βSaaS vs PaaS: different levels of controlβBuilding custom scheduled jobs
Section titled βBuilding custom scheduled jobsβWhen built-in jobs do not cover your needs, you can create custom ones. Common use cases include:
- Content archival β Move outdated content to an archive section after a set period
- Data synchronization β Pull product data from an external PIM or ERP system
- Report generation β Compile content statistics and email them to stakeholders
- Cache warming β Pre-render high-traffic pages after a deployment
A custom scheduled job is a class that inherits from ScheduledJobBase. You define the Execute method with your logic. The CMS handles scheduling, execution tracking, and error reporting.
Key considerations for custom jobs
Section titled βKey considerations for custom jobsβ- Idempotency. Your job might run twice if the previous execution overlaps. Design it so running twice produces the same result as running once.
- Progress reporting. For long-running jobs, report progress so administrators can see what the job is doing. Use the
OnStatusChangedmethod to update the status message. - Error handling. Catch exceptions and log meaningful messages. A silent failure is worse than a loud one.
- Execution time. Keep jobs focused and fast. A job that takes three hours blocks other jobs in single-threaded environments. Break large tasks into smaller batches.
Monitoring scheduled jobs
Section titled βMonitoring scheduled jobsβThe CMS admin interface shows the status of all scheduled jobs:
- Last run time β When the job last executed
- Last result β Whether it succeeded, failed, or was stopped
- Next scheduled run β When the job will run next
- Running status β Whether the job is currently executing
Check job status regularly. A silently failing job can cause cascading problems. If Publish Delayed Content stops running, scheduled posts never go live. If Link Validation stops, broken links accumulate undetected.
Setting up alerts
Section titled βSetting up alertsβFor production environments, do not rely on manual monitoring alone. Configure alerts that notify your team when a critical job fails. On PaaS, integrate with your application monitoring stack (Application Insights, Datadog, or similar). On SaaS, check the platformβs built-in notification options.