From c3ab5dd2a5ee03d840b01e1494084b421fea8f53 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Thu, 27 Jun 2019 15:34:12 -0400 Subject: [PATCH] log timed-out query --- db/db.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/db/db.go b/db/db.go index a9304a9..958c9c0 100644 --- a/db/db.go +++ b/db/db.go @@ -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) }