Recurring job

On this page 7

A recurring job is a unit of automated work that a scheduler triggers repeatedly according to a time rule, such as every fifteen minutes, every night at 02:00 or on the first business day of each month. In scheduling within automation, it is the standard way to run maintenance, synchronization, reporting and cleanup tasks without human initiation, and it differs from a one-off delayed job because its definition persists after each run.

The recurring job itself is only a schedule plus a payload. Each time the rule fires, the scheduler creates a concrete job instance (often called a run or occurrence), places it on a job queue or hands it to a worker, and records the outcome. Separating the persistent definition from the individual runs is what makes recurring jobs observable, retryable and safe to change.

How a recurring job is triggered and executed

A recurring job runs through a fire, enqueue, execute and record cycle that repeats for as long as the definition is active. The scheduler keeps a next fire time for each definition, wakes up when that time arrives, creates a run, and then computes the following fire time from the rule.

In most systems the scheduler and the executor are separate components. A task scheduler such as Quartz Scheduler, APScheduler or the periodic module of Celery decides when work is due, while workers pull the resulting job instances from a queue and perform them. This split lets a single scheduler drive hundreds of workers and lets runs survive a worker crash.

The table below summarizes the main parts of a recurring job definition and what each one controls.

ElementTypical formWhat it controls
Schedule ruleCron expression, fixed interval or calendarWhen each run is due
Time zoneUTC or a named zone such as Europe/BerlinHow wall-clock rules map to real instants
PayloadJob class, function name and argumentsWhat work each run performs
Misfire policySkip, run once or run all missedBehavior after downtime
Overlap policyAllow, skip or queueWhat happens if the previous run is still active
Timeout and retriesSeconds or minutes, retry countHow long a run may last and how failures are handled
Core elements of a recurring job definition

Ways to express a recurring schedule

Recurring schedules are expressed in three main forms: cron expressions, fixed intervals and calendar or business-day rules. The choice determines whether runs align to the clock or drift with execution time, and how the schedule reacts to daylight saving changes.

A cron expression such as 0 2 * * 1-5 aligns runs to wall-clock moments, here 02:00 on weekdays. A fixed interval such as every 300 seconds measures time from a start point or from the end of the previous run, so it is simple but not tied to the clock. Calendar rules add holidays, business days and exclusions, which enterprise workload automation tools such as Control-M handle natively.

Schedule typeExampleStrengthMain weakness
Cron expressionEvery weekday at 02:00Clock-aligned, widely understoodDaylight saving gaps and repeats
Fixed rate intervalEvery 5 minutes from startPredictable frequencyRuns can pile up if work is slow
Fixed delay interval5 minutes after previous run endsNever overlaps itselfStart times drift over the day
Business calendarFirst working day of the monthMatches finance and payroll cyclesNeeds a maintained holiday calendar
Schedule types and their characteristics

Time zone handling is a frequent source of defects. A job scheduled for 02:30 local time may run twice or not at all on daylight saving transition days, which is why many teams schedule critical recurring jobs in UTC and convert only for display.

A recurring job is defined by repetition on a time rule, which separates it from jobs triggered once, by events or by other jobs. Many real workflows combine these types, for example a recurring trigger that launches a batch job with downstream job dependencies.

Job typeTriggerLifetime of definitionTypical use
Recurring jobTime rule that repeatsPersists across runsNightly cleanup, hourly sync
Delayed jobSingle future momentEnds after one runSend a reminder in 24 hours
Batch jobSchedule, event or manual startOne processing run over a data setMonthly invoice generation
Event-driven jobMessage, webhook or file arrivalExists per eventProcess an uploaded image
BackfillManual request for past periodsTemporaryRecompute missed daily reports
How recurring jobs differ from neighboring concepts

The distinction matters in operations. A recurring job that misses runs during an outage may need a backfill to recover the skipped periods, while an event-driven job usually recovers by replaying messages from its queue.

Designing reliable recurring jobs

A reliable recurring job is idempotent, bounded in time and protected against overlap. Because the same job runs hundreds or thousands of times, small design flaws compound into duplicated data, stuck queues or silent gaps.

  • Make each run idempotent, so that running it twice for the same period produces the same result; key work by the scheduled period rather than by the current time.
  • Pass the logical run time as a parameter instead of reading the system clock, which makes reruns and backfills correct.
  • Set a job timeout shorter than the interval, so that a hung run cannot block the next one indefinitely.
  • Use a distributed lock or uniqueness key when several scheduler replicas exist, so that each occurrence fires only once.
  • Apply a concurrency limit to protect databases and external APIs from simultaneous runs.

The decision table below shows common situations and the configuration that usually fits them.

SituationRecommended settingReason
Run may exceed its intervalSkip overlapping runsPrevents parallel runs on the same data
Missed runs carry business valueRun all missed occurrencesEach period must be processed
Only the latest state mattersRun once after misfireAvoids a burst of redundant work
Several scheduler instancesLeader election or lockingGuarantees a single firing
Heavy load at midnightStagger start timesSpreads load across the hour
Choosing recurring job settings

Failure modes and monitoring of recurring jobs

The most dangerous failure of a recurring job is a run that silently does not happen. Errors in a run are usually logged, but a scheduler that stops firing, a disabled definition or a misconfigured cron expression often produces no error at all.

Effective monitoring therefore tracks absence as well as failure. A common pattern is a heartbeat or dead man’s switch: each successful run reports in, and an alert fires when no report arrives within the expected window plus a grace period.

SymptomLikely causeFix
Duplicate records each runMultiple schedulers firingAdd locking or a single leader
Runs stop after a deployDefinition lost or renamedStore schedules declaratively in code
Growing queue backlogRun time exceeds intervalSkip overlaps or lengthen the interval
Missing data for one nightDaylight saving gapSchedule in UTC and backfill
Spikes at round hoursSynchronized start timesAdd random offset or stagger
Common symptoms, causes and fixes

Another frequent mistake is the thundering herd at round times: when many teams schedule jobs at 00:00 or at the top of each hour, shared databases receive a burst of load. Adding a small offset, such as 00:07 instead of 00:00, is a cheap and effective remedy.

Put simply

A recurring job is a task the computer repeats on a timetable. Think of an alarm clock set for every weekday morning: you set it once, and it rings each day without being set again.

The computer keeps the rule, for example every night at two o’clock, and starts the work each time the rule says so. The key idea is that people define the job once, and the system then carries it out reliably, again and again, while someone watches that it really runs.

In practice

An online retailer needs fresh stock levels from three warehouse systems. The platform team defines a recurring job with the cron expression */15 * * * * in UTC, so a synchronization run starts every 15 minutes. Each run receives its logical time window as a parameter, reads changes from that window and writes them with upsert operations, which keeps the job idempotent if it is retried.

Because a slow warehouse API once made a run last 22 minutes, the team set a 12-minute timeout and an overlap policy that skips a run if the previous one is still active. A heartbeat check alerts the on-call engineer if no successful run is reported for 45 minutes. After these changes, duplicate stock updates disappeared and missed synchronizations were detected within the hour instead of the next morning.