mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
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:
parent
b5b169aea8
commit
9b5e016e57
1 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue