mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
server-esm: Handle more straightforward requires
This commit is contained in:
parent
f137d38300
commit
508b5e3c69
@ -15,6 +15,9 @@ import optionsInitService from "./options_init.js";
|
|||||||
import BNote from "../becca/entities/bnote.js";
|
import BNote from "../becca/entities/bnote.js";
|
||||||
import BBranch from "../becca/entities/bbranch.js";
|
import BBranch from "../becca/entities/bbranch.js";
|
||||||
import zipImportService from "./import/zip.js";
|
import zipImportService from "./import/zip.js";
|
||||||
|
import becca_loader from "../becca/becca_loader.js";
|
||||||
|
import password from "./encryption/password.js";
|
||||||
|
import backup from "./backup.js";
|
||||||
|
|
||||||
const dbReady = utils.deferred<void>();
|
const dbReady = utils.deferred<void>();
|
||||||
|
|
||||||
@ -65,7 +68,7 @@ async function createInitialDatabase() {
|
|||||||
|
|
||||||
sql.executeScript(schema);
|
sql.executeScript(schema);
|
||||||
|
|
||||||
require('../becca/becca_loader').load();
|
becca_loader.load();
|
||||||
|
|
||||||
log.info("Creating root note ...");
|
log.info("Creating root note ...");
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ async function createInitialDatabase() {
|
|||||||
optionsInitService.initDocumentOptions();
|
optionsInitService.initDocumentOptions();
|
||||||
optionsInitService.initNotSyncedOptions(true, {});
|
optionsInitService.initNotSyncedOptions(true, {});
|
||||||
optionsInitService.initStartupOptions();
|
optionsInitService.initStartupOptions();
|
||||||
require('./encryption/password').resetPassword();
|
password.resetPassword();
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("Importing demo content ...");
|
log.info("Importing demo content ...");
|
||||||
@ -129,7 +132,7 @@ function createDatabaseForSync(options: OptionRow[], syncServerHost = '', syncPr
|
|||||||
sql.transactional(() => {
|
sql.transactional(() => {
|
||||||
sql.executeScript(schema);
|
sql.executeScript(schema);
|
||||||
|
|
||||||
require('./options_init').initNotSyncedOptions(false, { syncServerHost, syncProxy });
|
optionsInitService.initNotSyncedOptions(false, { syncServerHost, syncProxy });
|
||||||
|
|
||||||
// document options required for sync to kick off
|
// document options required for sync to kick off
|
||||||
for (const opt of options) {
|
for (const opt of options) {
|
||||||
@ -164,10 +167,10 @@ dbReady.then(() => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(() => require('./backup').regularBackup(), 4 * 60 * 60 * 1000);
|
setInterval(() => backup.regularBackup(), 4 * 60 * 60 * 1000);
|
||||||
|
|
||||||
// kickoff first backup soon after start up
|
// kickoff first backup soon after start up
|
||||||
setTimeout(() => require('./backup').regularBackup(), 5 * 60 * 1000);
|
setTimeout(() => backup.regularBackup(), 5 * 60 * 1000);
|
||||||
|
|
||||||
// optimize is usually inexpensive no-op, so running it semi-frequently is not a big deal
|
// optimize is usually inexpensive no-op, so running it semi-frequently is not a big deal
|
||||||
setTimeout(() => optimize(), 60 * 60 * 1000);
|
setTimeout(() => optimize(), 60 * 60 * 1000);
|
||||||
|
@ -21,6 +21,7 @@ import { EntityChange, EntityChangeRecord, EntityRow } from './entity_changes_in
|
|||||||
import { CookieJar, ExecOpts } from './request_interface';
|
import { CookieJar, ExecOpts } from './request_interface';
|
||||||
import setupService from "./setup.js";
|
import setupService from "./setup.js";
|
||||||
import consistency_checks from "./consistency_checks.js";
|
import consistency_checks from "./consistency_checks.js";
|
||||||
|
import becca_loader from "../becca/becca_loader.js";
|
||||||
|
|
||||||
let proxyToggle = true;
|
let proxyToggle = true;
|
||||||
|
|
||||||
@ -442,7 +443,7 @@ function getOutstandingPullCount() {
|
|||||||
return outstandingPullCount;
|
return outstandingPullCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
require('../becca/becca_loader').beccaLoaded.then(() => {
|
becca_loader.beccaLoaded.then(() => {
|
||||||
setInterval(cls.wrap(sync), 60000);
|
setInterval(cls.wrap(sync), 60000);
|
||||||
|
|
||||||
// kickoff initial sync immediately, but should happen after initial consistency checks
|
// kickoff initial sync immediately, but should happen after initial consistency checks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user