The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Sign-in: two servers' first sign-ups at the same moment don't fail closed
Adarsh32e98a9b24ba
diff --git a/src/server/auth-store.ts b/src/server/auth-store.tsindex 51ed3db0..dc558938 100644--- a/src/server/auth-store.ts+++ b/src/server/auth-store.ts@@ -1163,7 +1163,12 @@ export function authStoreMode(): AuthStoreMode {function beforeMove(): AuthStoreMode {const key = statKey();if (key === null) {- if (hasRows()) return failClosed("failed", "The database holds sign-in rows without a record of where they came from.");+ if (hasRows()) {+ // Another server's first write (its marker and its rows, in one transaction) can land between the two reads.+ const set = marker();+ if (set) return set.state === "bridge" ? bridgeTick(set) : afterMove(set);+ return failClosed("failed", "The database holds sign-in rows without a record of where they came from.");+ }return "fresh";}if (s.bad?.key === key && (s.bad.mode === "unreadable" || s.bad.data)) return s.bad.mode;diff --git a/tests/auth-migration.test.ts b/tests/auth-migration.test.tsindex f123a8a4..9dc67c90 100644--- a/tests/auth-migration.test.ts+++ b/tests/auth-migration.test.ts@@ -951,8 +951,8 @@ describe("a crash, or another server, while moving in", () => {const done = await Promise.all(runs);for (const d of done) expect(d.code, d.out).toBe(0);const results = done.map((d) => result(d.out)?.result);- expect(results.filter((r) => r === "ok")).toHaveLength(1);- expect(results.filter((r) => r === "409")).toHaveLength(3);+ // One in, three told the email is taken (sorted: a failure shows what the odd one said).+ expect(results.map(String).sort()).toEqual(["409", "409", "409", "ok"]);const srv = await server(dir);expect(srv.auth.listAccounts().map((a) => a.email)).toEqual(["[email protected]"]);}, 60_000);