fix: resolve P1 backend consistency issues

This commit is contained in:
richjohnrambo
2026-09-08 16:23:21 +08:00
parent 06945a4050
commit 0b3c0b1c78
13 changed files with 587 additions and 57 deletions
+6 -1
View File
@@ -3,6 +3,7 @@ package main
import (
"container/heap"
crand "crypto/rand"
"errors"
"math/rand"
"strings"
"time"
@@ -216,7 +217,11 @@ func replyCreateUser(s *Session, msg *ClientComMessage, rec *auth.Rec) {
// Create user record in the database.
if _, err := store.Users.Create(s.tenantID, &user, private); err != nil {
logs.Warn.Println("create user: failed to create user", err, "sid=", s.sid)
s.queueOut(ErrUnknown(msg.Id, "", msg.Timestamp))
params := map[string]any(nil)
if errors.Is(err, types.ErrDuplicate) && phoneRegistration {
params = map[string]any{"what": "phone", "reason": "PHONE_ALREADY_REGISTERED"}
}
s.queueOut(decodeStoreError(err, msg.Id, msg.Timestamp, params))
return
}