Browse Source

Add new err func to wflib and sqlite builds

oauth-gitea
Matt Baer 2 years ago
parent
commit
07debec8d5
  1. 4
      database-lib.go
  2. 12
      database-sqlite.go

4
database-lib.go

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

12
database-sqlite.go

@ -1,7 +1,7 @@
// +build sqlite,!wflib
/*
* Copyright © 2019 A Bunch Tell LLC.
* Copyright © 2019-2020 A Bunch Tell LLC.
*
* This file is part of WriteFreely.
*
@ -60,3 +60,13 @@ func (db *datastore) isIgnorableError(err error) bool {
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
}

Loading…
Cancel
Save