Saga state, timeouts, and stuck sagas
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
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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.