Add new err func to wflib and sqlite builds

This commit is contained in:
Matt Baer 2020-03-27 11:48:20 -04:00
parent 0285a9b0bd
commit 07debec8d5
2 changed files with 15 additions and 1 deletions

View file

@ -22,3 +22,7 @@ func (db *datastore) isDuplicateKeyErr(err error) bool {
func (db *datastore) isIgnorableError(err error) bool { func (db *datastore) isIgnorableError(err error) bool {
return false return false
} }
func (db *datastore) isHighLoadError(err error) bool {
return false
}

View file

@ -1,7 +1,7 @@
// +build sqlite,!wflib // +build sqlite,!wflib
/* /*
* Copyright © 2019 A Bunch Tell LLC. * Copyright © 2019-2020 A Bunch Tell LLC.
* *
* This file is part of WriteFreely. * This file is part of WriteFreely.
* *
@ -60,3 +60,13 @@ func (db *datastore) isIgnorableError(err error) bool {
return false return false
} }
func (db *datastore) isHighLoadError(err error) bool {
if db.driverName == driverMySQL {
if mysqlErr, ok := err.(*mysql.MySQLError); ok {
return mysqlErr.Number == mySQLErrMaxUserConns || mysqlErr.Number == mySQLErrTooManyConns
}
}
return false
}