mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
perf(signup): derive a web sign-up's password off the main thread
POST /api/register used accounts.register, whose scryptSync froze every player for as long as each password took, so a burst of sign-ups was felt in the game. accounts.registerAsync checks the same things, derives the hash on libuv's pool (hashPasswordAsync), checks the name again after it (another request may have taken it meanwhile) and inserts the account as before. The game's own Create Account keeps the sync path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6645bf66b3
commit
43f2717b44
2 files changed
+30
-2
No files matched your search
+1
-1
@@ -282,7 +282,7 @@ const handle = async (route, params, body, from) => {
|
||||
if (!STARTER_ANIMALS.includes(avatarType)) {
|
||||
return {status: 400, body: {error: "choose_animal"}};
|
||||
}
|
||||
const result = accounts.register(username, password, {type: avatarType, email});
|
||||
const result = await accounts.registerAsync(username, password, {type: avatarType, email});
|
||||
if (result.account) {
|
||||
result.account.agreed = {version: config.termsVersion, at: Math.floor(Date.now() / 1000)};
|
||||
accounts.save(result.account);
|
||||
|
||||
Reference in new issue
Block a user