mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
Changed vacuum operation to run on startup only. Also it is now off by default.
This commit is contained in:
parent
d528e442ba
commit
04a8912a94
|
@ -160,12 +160,10 @@ export class Start extends Command {
|
||||||
const dbType = await GenericHelpers.getConfigValue('database.type') as DatabaseType;
|
const dbType = await GenericHelpers.getConfigValue('database.type') as DatabaseType;
|
||||||
|
|
||||||
if (dbType === 'sqlite') {
|
if (dbType === 'sqlite') {
|
||||||
const vacuumInterval = config.get('database.sqlite.vacuumInterval') as number;
|
const shouldRunVacuum = config.get('database.sqlite.executeVacuumOnStartup') as number;
|
||||||
if (vacuumInterval >= 0) {
|
if (shouldRunVacuum) {
|
||||||
|
console.log('ran vacuum');
|
||||||
Db.collections.Execution!.query("VACUUM;");
|
Db.collections.Execution!.query("VACUUM;");
|
||||||
if (vacuumInterval > 0) {
|
|
||||||
setInterval(() => Db.collections.Execution!.query("VACUUM;"), vacuumInterval * 1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,11 +125,11 @@ const config = convict({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sqlite: {
|
sqlite: {
|
||||||
vacuumInterval: {
|
executeVacuumOnStartup: {
|
||||||
doc: 'SQLite Vacuum operation interval',
|
doc: 'Runs VACUUM operation on startup to rebuild the database. Reduces filesize and optimizes indexes. WARNING: This is a long running blocking operation. Will increase boot time.',
|
||||||
format: Number,
|
format: Boolean,
|
||||||
default: 86400, // Given in seconds; -1 disables. 0 executes only at startup.
|
default: false,
|
||||||
env: 'DB_SQLITE_VACUUM_INTERVAL',
|
env: 'DB_SQLITE_VACUUM_ON_STARTUP',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue