mirror of
https://github.com/outbackdingo/databunker.git
synced 2026-01-27 10:18:45 +00:00
prepare system to withstand high load
This commit is contained in:
@@ -9,6 +9,7 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/var/lib/mysql
|
||||
command: --max_connections=2000
|
||||
# this container's job is to initialize MySQL database. It should run just 1 time.
|
||||
databunker-init:
|
||||
#build: .
|
||||
|
||||
@@ -492,13 +492,16 @@ func (dbobj MySQLDB) getRecordInTableDo(q string, values []interface{}) (bson.M,
|
||||
}
|
||||
defer tx.Rollback()
|
||||
rows, err := tx.Query(q, values...)
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, nil
|
||||
} else if err != nil {
|
||||
if err != nil {
|
||||
if rows != nil {
|
||||
rows.Close()
|
||||
}
|
||||
if err == sql.ErrNoRows {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
flag := rows.Next()
|
||||
if flag == false {
|
||||
fmt.Printf("no result, flag: %t\n", flag)
|
||||
|
||||
@@ -146,7 +146,7 @@ func (e mainEnv) userGet(w http.ResponseWriter, r *http.Request, ps httprouter.P
|
||||
event.Record = userTOKEN
|
||||
}
|
||||
if err != nil {
|
||||
returnError(w, r, "internal error", 405, nil, event)
|
||||
returnError(w, r, "internal error", 405, err, event)
|
||||
return
|
||||
}
|
||||
authResult = e.enforceAuth(w, r, event)
|
||||
|
||||
Reference in New Issue
Block a user