mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
disable scanning for links while migration is running #4535
This commit is contained in:
parent
1e30c0702e
commit
807941e6a5
@ -48,6 +48,14 @@ function isEntityEventsDisabled() {
|
|||||||
return !!namespace.get('disableEntityEvents');
|
return !!namespace.get('disableEntityEvents');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMigrationRunning(running) {
|
||||||
|
namespace.set('migrationRunning', !!running);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMigrationRunning() {
|
||||||
|
return !!namespace.get('migrationRunning');
|
||||||
|
}
|
||||||
|
|
||||||
function disableSlowQueryLogging(disable) {
|
function disableSlowQueryLogging(disable) {
|
||||||
namespace.set('disableSlowQueryLogging', disable);
|
namespace.set('disableSlowQueryLogging', disable);
|
||||||
}
|
}
|
||||||
@ -102,5 +110,7 @@ module.exports = {
|
|||||||
putEntityChange,
|
putEntityChange,
|
||||||
ignoreEntityChangeIds,
|
ignoreEntityChangeIds,
|
||||||
disableSlowQueryLogging,
|
disableSlowQueryLogging,
|
||||||
isSlowQueryLoggingDisabled
|
isSlowQueryLoggingDisabled,
|
||||||
|
setMigrationRunning,
|
||||||
|
isMigrationRunning
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@ const log = require('./log');
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
const resourceDir = require('./resource_dir');
|
const resourceDir = require('./resource_dir');
|
||||||
const appInfo = require('./app_info');
|
const appInfo = require('./app_info');
|
||||||
|
const cls = require('./cls.js');
|
||||||
|
|
||||||
async function migrate() {
|
async function migrate() {
|
||||||
const currentDbVersion = getDbVersion();
|
const currentDbVersion = getDbVersion();
|
||||||
@ -51,6 +52,9 @@ async function migrate() {
|
|||||||
// all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version
|
// all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version
|
||||||
// otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app,
|
// otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app,
|
||||||
// and too old for the new app version.
|
// and too old for the new app version.
|
||||||
|
|
||||||
|
cls.setMigrationRunning(true);
|
||||||
|
|
||||||
sql.transactional(() => {
|
sql.transactional(() => {
|
||||||
for (const mig of migrations) {
|
for (const mig of migrations) {
|
||||||
try {
|
try {
|
||||||
|
@ -895,6 +895,11 @@ function scanForLinks(note, content) {
|
|||||||
* Things which have to be executed after updating content, but asynchronously (separate transaction)
|
* Things which have to be executed after updating content, but asynchronously (separate transaction)
|
||||||
*/
|
*/
|
||||||
async function asyncPostProcessContent(note, content) {
|
async function asyncPostProcessContent(note, content) {
|
||||||
|
if (cls.isMigrationRunning()) {
|
||||||
|
// this is rarely needed for migrations, but can cause trouble by e.g. triggering downloads
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (note.hasStringContent() && !utils.isString(content)) {
|
if (note.hasStringContent() && !utils.isString(content)) {
|
||||||
content = content.toString();
|
content = content.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user