fix(backend): dbErr 503 degradation for connection-class DB errors
This commit is contained in:
@@ -2,7 +2,6 @@ package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -28,8 +27,7 @@ func (a *api) login(c *gin.Context) {
|
||||
u, qerr := a.st.GetUserByName(c, req.Username)
|
||||
if qerr != nil {
|
||||
if !errors.Is(qerr, pgx.ErrNoRows) {
|
||||
log.Printf("db: %v", qerr)
|
||||
err(c, http.StatusInternalServerError, "internal", "db error")
|
||||
dbErr(c, qerr)
|
||||
return
|
||||
}
|
||||
// 用户不存在也走一次 bcrypt,防用户名枚举时序差
|
||||
|
||||
Reference in New Issue
Block a user