Files
company8 20924cfa4c feat: add persistence helpers, inflight coalescing, bootstrap cookies
Standalone library modules from PR #62:
- lib/persistence.js: atomic storageState save/restore with SHA256-hashed user dirs
- lib/inflight.js: coalesceInflight primitive for concurrent session creation dedup
- lib/cookies.js: importBootstrapCookies helper for first-run cookie seeding
- Unit tests for all three modules

Co-authored-by: company8 <compan@post.com>
2026-04-18 15:26:39 -07:00

17 lines
321 B
JavaScript

async function coalesceInflight(map, key, factory) {
const existing = map.get(key);
if (existing) return existing;
const promise = (async () => {
try {
return await factory();
} finally {
map.delete(key);
}
})();
map.set(key, promise);
return promise;
}
export { coalesceInflight };