log timed-out query

This commit is contained in:
Alex Grintsvayg 2019-06-27 15:34:12 -04:00
parent 2047fe6c05
commit c3ab5dd2a5
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -419,9 +419,12 @@ func exec(e Executor, query string, args ...interface{}) error {
Retry:
attempt++
_, err = e.Exec(query, args...)
if e, ok := err.(*mysql.MySQLError); ok && attempt <= maxAttempts && e.Number == 1205 {
//Error 1205: Lock wait timeout exceeded; try restarting transaction
goto Retry
if e, ok := err.(*mysql.MySQLError); ok && e.Number == 1205 {
if attempt <= maxAttempts {
//Error 1205: Lock wait timeout exceeded; try restarting transaction
goto Retry
}
err = errors.Prefix("Timed out query "+query, err)
}
return errors.Err(err)
}