Skip to content
Commit Detail

Commit fa67b7c

Author
Sunil Pai <spai@cloudflare.com> 2026-02-27 15:11:29 +0000
Parents
f389dff
Tree
3f12d5e
Remove redundant actor_unique_key from AlarmScheduler

Address review feedback from kentonv: since each DO namespace now has
its own separate SQLite database for alarm storage, the actor_unique_key
column in the _cf_ALARM table is redundant. Previously, AlarmScheduler
was designed to handle multiple namespaces in a single database, using
actor_unique_key to distinguish between them. Now that we store a
separate database per namespace, this column just wastes bytes and could
cause headaches if someone wants to change keys later. As kentonv noted,
this is best fixed now before any of these tables are written to disk in
the wild.

Changes:

- Simplified ActorKey struct to contain only actorId (removed uniqueKey)
- Simplified _cf_ALARM schema from (actor_unique_key, actor_id,
  scheduled_time) with a compound primary key to (actor_id, scheduled_time)
  with actor_id as the sole primary key
- Removed registerNamespace() -- the GetActorFn is now passed directly
  to the AlarmScheduler constructor, since each scheduler serves exactly
  one namespace
- Replaced the namespaces HashMap with a single GetActorFn member
- Restructured ActorNamespace::link() in server.c++ to create the
  GetActorFn once and pass it to whichever storage path (on-disk or
  in-memory) is used, eliminating duplication
- Removed unused setAlarmInMemory declaration and unused byte type alias

Files changed