When a transaction cannot lock the database, because it is already locked by another one,
SQLite by default throws an error: database is locked. This behavior is usually not appropriate when
concurrent access is needed, typically when multiple processes write to the same database.
PRAGMA busy_timeout lets you set a timeout or a handler for these events. When setting a timeout,
SQLite will try the transaction multiple times within this timeout.
https://rsqlite.r-dbi.org/reference/sqlitesetbusyhandler
retrying for 30000 milliseconds, 30seconds - this would be unreasonable for a distributed multi-tenant application,
but should be fine for local usage.
added mechanism for global settings (PRAGMA and DB level instructions).
fixes#341
//shrink the Database (maybe necessary after 20220503113100)
iferr:=tx.Exec("VACUUM;").Error;err!=nil{
returnerr
}
returnnil
},
},
})
iferr:=gm.Migrate();err!=nil{
sr.logger.Errorf("SQLite global configuration migrations failed with error. \n Please open a github issue at https://github.com/AnalogJ/scrutiny and attach a copy of your scrutiny.db file. \n %v",err)
returnerr
}
sr.logger.Infoln("SQLite global configuration migrations completed successfully")