mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
retry transiction on sqlite when busy
This commit is contained in:
parent
4cc66d07c3
commit
51d34126fc
1 changed files with 12 additions and 1 deletions
|
@ -15,6 +15,17 @@ const db = {
|
|||
connect (dbConf = config.db) {
|
||||
log.debug(`Connecting to DB: ${JSON.stringify(dbConf)}`)
|
||||
dbConf.dialectOptions = { autoJsonMap: false }
|
||||
if (dbConf.dialect === 'sqlite') {
|
||||
dbConf.retry = {
|
||||
match: [
|
||||
Sequelize.ConnectionError,
|
||||
Sequelize.ConnectionTimedOutError,
|
||||
Sequelize.TimeoutError,
|
||||
/Deadlock/i,
|
||||
/SQLITE_BUSY/],
|
||||
max: 15
|
||||
}
|
||||
}
|
||||
db.sequelize = new Sequelize(dbConf)
|
||||
return db.sequelize.authenticate()
|
||||
},
|
||||
|
@ -39,7 +50,7 @@ const db = {
|
|||
path: path.resolve(__dirname, '..', '..', 'migrations')
|
||||
}
|
||||
})
|
||||
return await umzug.up()
|
||||
return umzug.up()
|
||||
},
|
||||
async initialize () {
|
||||
if (config.status === 'READY') {
|
||||
|
|
Loading…
Reference in a new issue