Storage: Add support for sortBy selector (#80680)
* add support for sortBy field selector * use label selectors instead of field selectors * set entity_labels on create & update * make entity server integration tests work * test fixes * be more consistent with handling of empty body, meta or status * workaround for database is locked errors during migration * fix double import of sqlite3 * rename functions and tidy up * refactor update * disable integration tests until we can fix the database locking issue
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package migrator
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"github.com/golang-migrate/migrate/v4/database"
|
||||
_ "github.com/lib/pq"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/mattn/go-sqlite3"
|
||||
"go.uber.org/atomic"
|
||||
"xorm.io/xorm"
|
||||
|
||||
@@ -208,6 +209,13 @@ func (mg *Migrator) run() (err error) {
|
||||
|
||||
err := mg.InTransaction(func(sess *xorm.Session) error {
|
||||
err := mg.exec(m, sess)
|
||||
// if we get an sqlite busy/locked error, sleep 100ms and try again
|
||||
if errors.Is(err, sqlite3.ErrLocked) || errors.Is(err, sqlite3.ErrBusy) {
|
||||
mg.Logger.Debug("Database locked, sleeping then retrying", "error", err, "sql", sql)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
err = mg.exec(m, sess)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
mg.Logger.Error("Exec failed", "error", err, "sql", sql)
|
||||
record.Error = err.Error()
|
||||
|
||||
Reference in New Issue
Block a user