The AtmosphereConf talks your skyline missed
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: correct deadlock in requestLock (await prevLock, not currentLock)

The previous implementation constructed currentLock as
`prevLock.then(() => new Promise(resolve => releaseLock = resolve))`
and then `await currentLock` before running `fn`. That inner promise
only resolves when `releaseLock()` runs, but `releaseLock()` is in
the same caller's `finally`, which is only reached after the await
returns. Every OAuth session restore was awaiting a promise only
the caller itself could resolve, and hanging forever.

Fix: construct currentLock as a plain release-signal promise, store
it into the map immediately, then `await prevLock` (the previous
holder's release signal) before calling `fn`. The existing cleanup
that deletes the map entry when `locks.get(key) === currentLock`
is preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+4 -7
+4 -7
src/lib/auth/client.ts
··· 28 28 ): Promise<T> { 29 29 const prevLock = locks.get(key) ?? Promise.resolve(); 30 30 let releaseLock!: () => void; 31 - const currentLock = prevLock.then( 32 - () => 33 - new Promise<void>((resolve) => { 34 - releaseLock = resolve; 35 - }), 36 - ); 31 + const currentLock = new Promise<void>((resolve) => { 32 + releaseLock = resolve; 33 + }); 37 34 locks.set(key, currentLock); 38 35 try { 39 - await currentLock; 36 + await prevLock; 40 37 return await fn(); 41 38 } finally { 42 39 releaseLock();