CodeRigor

FREE COURSE / REAL PRACTICE

Queues, retries & reliable background work

Build deterministic Python models of bounded work admission, delivery ownership, retry budgets and idempotent effects, then integrate a restartable job-state simulation.

Free lessons & exercises7 authored lessons3 units

What you’ll work toward

Explain and test bounded admission, FIFO/priority order, producer-consumer ownership, acknowledgement/redelivery, capped retry budgets, idempotency, quarantine and ordered restart-state policies. The exercises are in memory and do not establish production durability or exactly-once delivery.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. The course map shows your actual readiness.

A look inside the first lesson

Bounded FIFO & priority queues

Python
from collections import deque
import heapq

ready = deque(["first", "second"])
print(ready.popleft())
heap = []
for sequence, (priority, job) in enumerate([(4, "slow"), (1, "urgent"), (1, "also urgent")]):
    heapq.heappush(heap, (priority, sequence, job))
print([heapq.heappop(heap)[2] for _ in range(3)])

Your course outline

Follow the lessons in curriculum order. Open a unit to preview the ideas you’ll work with.

UNIT 013 lessons Bounded work and delivery ownership
  1. LESSON 01.01

    Bounded FIFO & priority queues

    Separate admission, service order and stable priority ties in a bounded in-memory buffer.

    Open lesson
  2. LESSON 01.02

    Producer-consumer state & backpressure

    Model admission, worker ownership, completion and graceful draining without threads or timing assumptions.

    Open lesson
  3. LESSON 01.03

    Acknowledgements, leases & redelivery

    Keep delivery tokens separate from job identity and reject stale acknowledgements at exact lease boundaries.

    Open lesson
UNIT 023 lessons Retry safety and poison handling
  1. LESSON 02.01

    Retry budgets, backoff & fake clocks

    Schedule bounded retries with capped exponential delays and an exclusive start deadline, without sleeping.

    Open lesson
  2. LESSON 02.02

    Idempotency keys & effect deduplication

    Apply an account effect once per stable message key and reject conflicting key reuse without partial state.

    Open lesson
  3. LESSON 02.03

    Poison messages & controlled replay

    Separate transient failures from permanent poison work, retain diagnostics and make replay an explicit decision.

    Open lesson
UNIT 031 lesson Integrated reliable job state
  1. LESSON 03.01

    Reliable job-state simulation

    Integrate bounded admission, leases, retries, idempotent effects, ordering and restart snapshots in one explicit state machine.

    Open lesson