diff --git a/diigo-cache/src/index.ts b/diigo-cache/src/index.ts index e61234a..c5be9ca 100644 --- a/diigo-cache/src/index.ts +++ b/diigo-cache/src/index.ts @@ -16,11 +16,8 @@ import { updatedISO, usernameOf } from "./items.js"; import { toWebkey, idFromWebkey, isWebkey, shashKey } from "./webkeys.js"; import { pmSave } from "./pm-save.js"; -/** - * the live clock. This module is the worker's edge — the runtime's entry, - * like a program script — so ambient time is reached here and delegated - * down; the cache logic only uses the clock it is given. - */ +/** the live clock: the worker's entry module reads ambient time and hands + * it to the cache logic, which uses only the clock it is given */ function liveClock(): Clock { return { now: () => Date.now(), sleep: (ms) => new Promise((r) => setTimeout(r, ms)) }; } @@ -382,9 +379,7 @@ async function publishCache(request: Request, env: Env): Promise { if (wiring.publicId) { return Response.json({ cacheId, publicId: wiring.publicId, status: "already published" }); } - // seed the projection *now*, while the cache is still private-only: - // only rows already cached and marked shared can enter the public - // side; the username rides the same rows + // the username comes from the items: the cookie's own account const firstPage = await cache.page(1, PAGE_SIZE); const firstItem = firstPage.items[0] ? (JSON.parse(firstPage.items[0]) as Item) : undefined; const username = usernameOf(firstItem);