0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added perf-improving PRAGMAs in testing mode

- These two things are meant to improve performance at the cost of reliability.
- Perfect for testing, however I think they make a minimal impact on modern SSDs :(
- Still worth a shot to see if it helps with CI
This commit is contained in:
Hannah Wolfe 2021-11-18 12:54:14 +00:00
parent 78ee0509bf
commit 80358266b2
2 changed files with 7 additions and 4 deletions

View file

@ -17,6 +17,13 @@ function configure(dbConfig) {
dbConfig.pool = {
afterCreate(conn, cb) {
conn.run('PRAGMA foreign_keys = ON', cb);
// These two are meant to improve performance at the cost of reliability
// Should be safe for tests. We add them here and leave them on
if (config.get('env').startsWith('testing')) {
conn.run('PRAGMA synchronous = OFF;');
conn.run('PRAGMA journal_mode = TRUNCATE;');
}
}
};

View file

@ -157,10 +157,6 @@ const freshModeGhostStart = async (options) => {
// Do a full database initialisation
await knexMigrator.init();
if (config.get('database:client') === 'sqlite3') {
await db.knex.raw('PRAGMA journal_mode = TRUNCATE;');
}
await settingsService.init();
// Reset the URL service generators