Also retry driver.ErrBadConn

ErrBadConn is returned by a driver to signal that a driver.Conn is
in a bad state. We have to retry with these errors as well.
This commit is contained in:
Eric Lippmann 2021-07-05 09:34:15 +02:00
parent b5b169aea8
commit 9b5e016e57

View file

@ -2,6 +2,7 @@ package icingadb
import (
"context"
"database/sql/driver"
"fmt"
"github.com/go-sql-driver/mysql"
"github.com/icinga/icingadb/internal"
@ -437,6 +438,10 @@ func (db *DB) Delete(ctx context.Context, entityType contracts.Entity, ids []int
}
func IsRetryable(err error) bool {
if errors.Is(err, driver.ErrBadConn) {
return true
}
if errors.Is(err, mysql.ErrInvalidConn) {
return true
}