Revert "Merge pull request 'Complete Housekeeping migration and /ase cutover' (#52) from codex/housekeeping-complete into main"
This reverts commit488b6e57c4, reversing changes made tob506b4499a.
This commit is contained in:
1 parent
488b6e57c4
commit
b1ddda66ff
802 files changed
+61370
-76659
No files matched your search
+8
-14
@@ -33,20 +33,14 @@ describe("cached (memory-only, no Redis)", () => {
|
||||
});
|
||||
|
||||
it("recomputes after the TTL expires", async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
vi.setSystemTime(1_000);
|
||||
let count = 0;
|
||||
const fn = vi.fn(async () => ++count);
|
||||
const key = `ttl-${Math.random()}`;
|
||||
expect(await cached(key, 100, fn)).toBe(1);
|
||||
expect(await cached(key, 100, fn)).toBe(1);
|
||||
vi.advanceTimersByTime(100);
|
||||
expect(await cached(key, 100, fn)).toBe(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
let count = 0;
|
||||
const fn = vi.fn(async () => ++count);
|
||||
const key = `ttl-${Math.random()}`;
|
||||
expect(await cached(key, 1, fn)).toBe(1);
|
||||
expect(await cached(key, 1, fn)).toBe(1);
|
||||
await new Promise((r) => setTimeout(r, 10));
|
||||
expect(await cached(key, 1, fn)).toBe(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("invalidates a key so the next read recomputes", async () => {
|
||||
|
||||
Reference in new issue
Block a user