From 0fe5c64d0408cac1d608e184e965159fd738658b Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Mon, 4 May 2026 08:28:24 +0300 Subject: [PATCH] Use per-topic key shape in README "How it works" The README listed the Redis structures as bare `timers_timeline` / `timers_payloads`, but actual keys are `{prefix_key}:{full_topic}` (see `subscriber/config.py:24-30`). Anyone debugging via `redis-cli` would not find the bare keys. Update the README to show the `{key}:{topic}` shape, give a concrete example, and mention that `TimersRouter(prefix=...)` extends the suffix. --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 94f3520..cce13fa 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,12 @@ timer_id = await broker.publish( ## How it works -Timers are stored in Redis as two structures: +Timers are stored in Redis as two keys **per topic**: -- A **sorted set** (`timers_timeline`) with the activation timestamp as score -- A **hash** (`timers_payloads`) with the serialized message body +- A **sorted set** (`timers_timeline:{topic}`) with the activation timestamp as score +- A **hash** (`timers_payloads:{topic}`) with the serialized message body + +So a timer on the `invoices` topic lives under `timers_timeline:invoices` and `timers_payloads:invoices` — handy when poking around in `redis-cli`. A `TimersRouter(prefix="my-service:")` extends the suffix to `my-service:invoices`. A polling loop checks for due timers and atomically claims each one via a Lua script that pushes its score forward by `lease_ttl` seconds — granting the