log timed-out query
This commit is contained in:
parent
2047fe6c05
commit
c3ab5dd2a5
1 changed files with 6 additions and 3 deletions
5
db/db.go
5
db/db.go
|
@ -419,10 +419,13 @@ func exec(e Executor, query string, args ...interface{}) error {
|
||||||
Retry:
|
Retry:
|
||||||
attempt++
|
attempt++
|
||||||
_, err = e.Exec(query, args...)
|
_, err = e.Exec(query, args...)
|
||||||
if e, ok := err.(*mysql.MySQLError); ok && attempt <= maxAttempts && e.Number == 1205 {
|
if e, ok := err.(*mysql.MySQLError); ok && e.Number == 1205 {
|
||||||
|
if attempt <= maxAttempts {
|
||||||
//Error 1205: Lock wait timeout exceeded; try restarting transaction
|
//Error 1205: Lock wait timeout exceeded; try restarting transaction
|
||||||
goto Retry
|
goto Retry
|
||||||
}
|
}
|
||||||
|
err = errors.Prefix("Timed out query "+query, err)
|
||||||
|
}
|
||||||
return errors.Err(err)
|
return errors.Err(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue