|
@@ -1,4 +1,4 @@
|
|
-import { Sequelize } from 'sequelize';
|
|
|
|
|
|
+import { Sequelize, Transaction } from 'sequelize';
|
|
import { getDatabasePath } from '../preload/utils';
|
|
import { getDatabasePath } from '../preload/utils';
|
|
|
|
|
|
// doc: https://sequelize.org/docs/v6/getting-started/
|
|
// doc: https://sequelize.org/docs/v6/getting-started/
|
|
@@ -16,6 +16,10 @@ const sequelize = new Sequelize({
|
|
min: 5,
|
|
min: 5,
|
|
acquire: 100000,
|
|
acquire: 100000,
|
|
},
|
|
},
|
|
|
|
+ // 对于使用了数据库事务的接口,高并发下,容易锁库。下面是解决办法。
|
|
|
|
+ // fix SQLITE_BUSY: database is locked
|
|
|
|
+ // https://github.com/sequelize/sequelize/issues/10304
|
|
|
|
+ transactionType: Transaction.TYPES.IMMEDIATE,
|
|
});
|
|
});
|
|
|
|
|
|
export default sequelize;
|
|
export default sequelize;
|