mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge remote-tracking branch 'origin/stable'
# Conflicts: # src/services/options_init.js
This commit is contained in:
commit
e1dd933ec0
@ -51,7 +51,7 @@ function initNotSyncedOptions(initialized, startNotePath = 'root', opts = {}) {
|
|||||||
optionService.createOption('theme', opts.theme || 'white', false);
|
optionService.createOption('theme', opts.theme || 'white', false);
|
||||||
|
|
||||||
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
|
optionService.createOption('syncServerHost', opts.syncServerHost || '', false);
|
||||||
optionService.createOption('syncServerTimeout', '5000', false);
|
optionService.createOption('syncServerTimeout', '60000', false);
|
||||||
optionService.createOption('syncProxy', opts.syncProxy || '', false);
|
optionService.createOption('syncProxy', opts.syncProxy || '', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,6 +132,9 @@ async function pullSync(syncContext) {
|
|||||||
const startDate = Date.now();
|
const startDate = Date.now();
|
||||||
|
|
||||||
const resp = await syncRequest(syncContext, 'GET', changesUri);
|
const resp = await syncRequest(syncContext, 'GET', changesUri);
|
||||||
|
|
||||||
|
const pulledDate = Date.now();
|
||||||
|
|
||||||
stats.outstandingPulls = resp.maxSyncId - lastSyncedPull;
|
stats.outstandingPulls = resp.maxSyncId - lastSyncedPull;
|
||||||
|
|
||||||
if (stats.outstandingPulls < 0) {
|
if (stats.outstandingPulls < 0) {
|
||||||
@ -162,7 +165,7 @@ async function pullSync(syncContext) {
|
|||||||
setLastSyncedPull(rows[rows.length - 1].sync.id);
|
setLastSyncedPull(rows[rows.length - 1].sync.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info(`Pulled and updated ${rows.length} changes from ${changesUri} in ${Date.now() - startDate}ms`);
|
log.info(`Pulled ${rows.length} changes in ${pulledDate - startDate}ms from ${changesUri} and applied them in ${Date.now() - pulledDate}ms`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appliedPulls > 0) {
|
if (appliedPulls > 0) {
|
||||||
|
@ -238,6 +238,9 @@ function getNoteTitle(filePath, replaceUnderscoresWithSpaces, noteMeta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function timeLimit(promise, limitMs) {
|
function timeLimit(promise, limitMs) {
|
||||||
|
// better stack trace if created outside of promise
|
||||||
|
const error = new Error('Process exceeded time limit ' + limitMs);
|
||||||
|
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
let resolved = false;
|
let resolved = false;
|
||||||
|
|
||||||
@ -250,7 +253,7 @@ function timeLimit(promise, limitMs) {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
rej(new Error('Process exceeded time limit ' + limitMs));
|
rej(error);
|
||||||
}
|
}
|
||||||
}, limitMs);
|
}, limitMs);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user