perf(sqlite): synchronous=normal

This commit is contained in:
Isaac 2023-06-17 17:01:06 +01:00
parent d77d37cf9e
commit 5895b3dd6e
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -55,9 +55,10 @@ module.exports = class Client extends FrameworkClient {
this.prisma = new PrismaClient();
if (process.env.DB_PROVIDER === 'sqlite') {
this.prisma.$use(sqliteMiddleware);
// make sqlite faster (https://www.sqlite.org/wal.html),
// make sqlite faster,
// and the missing parentheses are not a mistake, `$queryRaw` is a tagged template literal
this.log.debug(await this.prisma.$queryRaw`PRAGMA journal_mode=WAL;`);
this.log.debug(await this.prisma.$queryRaw`PRAGMA journal_mode=WAL;`); // https://www.sqlite.org/wal.html
this.log.debug(await this.prisma.$queryRaw`PRAGMA synchronous=normal;`); // https://www.sqlite.org/pragma.html#pragma_synchronous
}
this.keyv = new Keyv();
return super.login(token);