The reviewer's third finding: ten a second needs changes of the activity stack
Jonas Templestein, 2026-11-27 00:06 UTC · 4932b0c164abfa8c158f3cdc2c0f7edffc77bc02 · parent e8088d5
2 files changed
M core/itx/src/context/awake.ts
@@ -18,11 +18,12 @@ // - `AWAKE_ACTIVITY_DEBOUNCE_MS` after its activity stack changed or it said what it is. That // wait gathers a burst of such changes into one summary. It is no least time between two // summaries; -// - at a recheck, each `AWAKE_QUIET_MS` while it is busy, when its activity stack changed since -// the last summary or the last summary is `AWAKE_SUMMARY_EVERY_MS` old; +// - at a recheck, each `AWAKE_QUIET_MS` while it is busy, when such a change is not yet said or +// the last summary is `AWAKE_SUMMARY_EVERY_MS` old; // - before it closes. // A summary whose text equals the last one sent is not sent, so a wake can send none. A context -// with much activity sends about ten summaries a second. The accepting context keeps the durable +// whose activity stack changes often sends about ten summaries a second; one long activity that +// only appends sends one per `AWAKE_SUMMARY_EVERY_MS`. The accepting context keeps the durable // part of each summary that comes in one SQLite row (context-catalog.ts `store`). It writes that // row at each summary of an equal or later offset and does not compare the two: a summary that // differs in its activities alone writes the same row again. These rows are beside the rows
M core/lib/src/api.ts
@@ -1876,9 +1876,11 @@ * catalog's revision at which the row last changed. A ROW CHANGES WHEN ITS CONTEXT SENDS A * SUMMARY THAT DIFFERS in something the row holds: the counts and times of its events, its * storage, what it says of itself. A context that works sends a summary shortly after each - * burst of its activity, and one when it goes quiet. It gathers a burst for 100 ms, and that is - * no least time between two summaries. So the row of a context whose log grows fast changes - * about ten times a second: a watcher that draws should not draw at each frame. */ + * burst of changes of its activity stack, once in 15 s with no such change, and once when it + * goes quiet. It gathers a burst for 100 ms, and that is no least time between two summaries. + * So the row of a context that does many short pieces of work, each of which adds to its log, + * changes about ten times a second: a watcher that draws should not draw at each frame. One + * long piece of work that only adds to the log changes the row once in 15 s. */ export type CatalogRow = Omit<ContextListing, "awake" | "activities"> & { /** What the order `active` sorts by, in milliseconds: when the context was last active * (`lastActivityAt`, or `lastEventAt` when it has had no activity of its own). */