postgres: improve readability of error check

This commit is contained in:
Alex Suraci 2018-11-16 19:36:56 +00:00
parent 9b9013a560
commit aa068b667a

View File

@ -71,7 +71,7 @@ var (
err = tx.Commit()
if err != nil {
if pqErr, ok := err.(*pq.Error); ok && pqErr.Code == "40001" {
if pqErr, ok := err.(*pq.Error); ok && pqErr.Code.Name() == "serialization_failure" {
// serialization error; retry
continue
}