fixup! diigo-cache: the caches take their clock as a constructor argument
Past the transitional idiom: the cache logic (DiigoCacheLogic, PublicCacheLogic in cache.ts) requires its Clock, with no default, so cache.ts reaches no ambient time. The worker's entry module is the edge: it makes the live clock and exports the runtime-constructed DiigoCache/PublicCache as (ctx, env) subclasses that supply it (the Cloudflare constraint: the runtime constructs DOs with ctx and env only). Binding class names are unchanged, so stored state is too. The tests' FixedClockCache extends the logic class. Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
cf901ded5f
commit
961515d8db
6 files changed
+53
-31
No files matched your search
@@ -12,9 +12,9 @@ import { FIXED_NOW } from "./test-worker.js";
|
||||
// of 24, every 3rd private).
|
||||
|
||||
type TestEnv = {
|
||||
CACHE_DO: DurableObjectNamespace<import("../src/cache.js").DiigoCache>;
|
||||
CACHE_DO: DurableObjectNamespace<import("../src/index.js").DiigoCache>;
|
||||
CLOCKED_DO: DurableObjectNamespace<import("./test-worker.js").FixedClockCache>;
|
||||
PUBLIC_DO: DurableObjectNamespace<import("../src/cache.js").PublicCache>;
|
||||
PUBLIC_DO: DurableObjectNamespace<import("../src/index.js").PublicCache>;
|
||||
WEBAPP: { calls(): Promise<number> };
|
||||
};
|
||||
const testEnv = env as unknown as TestEnv;
|
||||
|
||||
Reference in new issue
Block a user