LESSON 73 / 215·2 min readIntermediate

Long-running workflows, retries, timeouts, and schedules

Should knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

State
The data describing where a workflow is now, what it already knows, and what still needs to happen.
Persistence
Saving information so it remains available after a request ends or a process restarts.
Durable
Able to retain progress and recover across interruptions. Durable workflows require appropriate storage and retry behavior.

Overview

  • Long-running workflows persist progress while waiting for jobs, timers, or people.
  • Retries repeat transiently failing work; timeouts cap waits; schedules start work at defined times.
  • Durable waiting should not consume an open request or a sleeping application worker.

Why this matters

Claims, document processing, and review can outlive any one process.

An everyday example

A case file remains open while waiting for an invoice, with a reminder date written on it.

A technical example

Start intake, wait up to a business-defined period for review, then escalate or expire; schedule periodic index refreshes.

How it works

  1. Persist state
  2. Register durable timer/event wait
  3. Release worker
  4. Receive event/timer
  5. Resume
  6. Retry eligible activities within deadline.

Architecture and flow

Start → durable steps → persisted wait → event/timer → resume → finish.

The insurance assistant example

Remind the customer about missing documents without losing progress if the server deploys overnight.

When to use it

Multi-day tasks, approvals, scheduled ingestion, and recoverable background work.

When to avoid it

Do not use setTimeout in one Node process as the only record of a critical reminder.

Interview answer

“I persist progress and use durable timers or correlated events. Retries and timeouts have bounded policies and observable outcomes.”

Benefits, trade-offs, and production considerations

  • Define schedule timezone and daylight-saving behavior where applicable.
  • Avoid overlapping refresh jobs, stale review events, and nested retries that multiply provider cost.
PAUSE & RECALL

Can you explain it without the notes?

Long-running workflows, retries, timeouts, and schedules

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Long-running workflows persist progress while waiting for jobs, timers, or people. Retries repeat transiently failing work; timeouts cap waits; schedules start work at defined times. Durable waiting should not consume an open request or a sleeping application…

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Idempotency, compensation, and human approvals

Adapted from 13_AI.MD · “Long-running workflows, retries, timeouts, and schedules”. Examples are study fragments; framework behavior can depend on your version.