Skip to content
Ameen Abozaid
Planned lessonMID-031-L06

Saga state, timeouts, and stuck sagas

  • Lesson 6 of 8
  • Mid-level
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

keep sagas from hanging forever.

Planned topics

  • Store state, step, deadline, and attempt count in the orchestrator's database.
  • A scheduled sweeper finds sagas past their deadline and triggers retry or compensation.
  • Make every reply handler idempotent and ignore replies for a state that has moved on.
  • Expose a stuck-saga metric and an admin way to retry or force compensation.
  • Give each step its own timeout shorter than the overall one.
Draft outline details

Demonstration

sql
SELECT id FROM order_saga
WHERE state NOT IN ('COMPLETED','FAILED') AND deadline < now()
FOR UPDATE SKIP LOCKED;

Check your understanding

What triggers action when a reply never arrives?

Show answer

A timeout sweeper acting on the saved deadline.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.