mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 18:50:41 +01:00
server-ts: Port becca_loader
This commit is contained in:
@@ -766,7 +766,7 @@ class ConsistencyChecks {
|
||||
}
|
||||
|
||||
if (this.reloadNeeded) {
|
||||
require('../becca/becca_loader.js').reload("consistency checks need becca reload");
|
||||
require('../becca/becca_loader').reload("consistency checks need becca reload");
|
||||
}
|
||||
|
||||
return !this.unrecoveredConsistencyErrors;
|
||||
|
||||
@@ -143,8 +143,8 @@ function getRows<T>(query: string, params: Params = []): T[] {
|
||||
return wrap(query, s => s.all(params)) as T[];
|
||||
}
|
||||
|
||||
function getRawRows<T extends {} | unknown[]>(query: string, params: Params = []): T[] | null {
|
||||
return wrap(query, s => s.raw().all(params)) as T[] | null;
|
||||
function getRawRows<T extends {} | unknown[]>(query: string, params: Params = []): T[] {
|
||||
return (wrap(query, s => s.raw().all(params)) as T[] | null) || [];
|
||||
}
|
||||
|
||||
function iterateRows(query: string, params: Params = []) {
|
||||
@@ -259,7 +259,7 @@ function transactional<T>(func: (statement: Statement) => T) {
|
||||
if (entityChangeIds.length > 0) {
|
||||
log.info("Transaction rollback dirtied the becca, forcing reload.");
|
||||
|
||||
require('../becca/becca_loader.js').load();
|
||||
require('../becca/becca_loader').load();
|
||||
}
|
||||
|
||||
// the maxEntityChangeId has been incremented during failed transaction, need to recalculate
|
||||
|
||||
@@ -61,7 +61,7 @@ async function createInitialDatabase() {
|
||||
|
||||
sql.executeScript(schema);
|
||||
|
||||
require('../becca/becca_loader.js').load();
|
||||
require('../becca/becca_loader').load();
|
||||
|
||||
const BNote = require('../becca/entities/bnote');
|
||||
const BBranch = require('../becca/entities/bbranch');
|
||||
|
||||
@@ -399,7 +399,7 @@ function getOutstandingPullCount() {
|
||||
return outstandingPullCount;
|
||||
}
|
||||
|
||||
require('../becca/becca_loader.js').beccaLoaded.then(() => {
|
||||
require('../becca/becca_loader').beccaLoaded.then(() => {
|
||||
setInterval(cls.wrap(sync), 60000);
|
||||
|
||||
// kickoff initial sync immediately, but should happen after initial consistency checks
|
||||
|
||||
Reference in New Issue
Block a user