mirror of
https://github.com/zadam/trilium.git
synced 2024-09-20 15:45:58 +08:00
Merge remote-tracking branch 'origin/stable'
# Conflicts: # libraries/ckeditor/ckeditor.js.map # package.json # src/routes/api/login.js # src/routes/api/sync.js # src/routes/index.js # src/services/app_info.js # src/services/sync.js
This commit is contained in:
commit
f4a4e746bf
4
db/migrations/0159__fix_isSynced_in_sync_rows.sql
Normal file
4
db/migrations/0159__fix_isSynced_in_sync_rows.sql
Normal file
|
@ -0,0 +1,4 @@
|
|||
UPDATE sync SET isSynced = 1 WHERE entityName != 'options' OR (
|
||||
entityName = 'options'
|
||||
AND 1 = (SELECT isSynced FROM options WHERE name = sync.entityId)
|
||||
)
|
2
libraries/ckeditor/ckeditor.js
vendored
2
libraries/ckeditor/ckeditor.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
|||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.43.0-beta",
|
||||
"version": "0.43.3",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
|
|
@ -328,6 +328,9 @@ function dynamicRequire(moduleName) {
|
|||
}
|
||||
|
||||
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) => {
|
||||
let resolved = false;
|
||||
|
||||
|
@ -339,7 +342,7 @@ function timeLimit(promise, limitMs) {
|
|||
|
||||
setTimeout(() => {
|
||||
if (!resolved) {
|
||||
rej(new Error('Process exceeded time limit ' + limitMs));
|
||||
rej(error);
|
||||
}
|
||||
}, limitMs);
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@ function loginSync(req) {
|
|||
|
||||
return {
|
||||
sourceId: sourceIdService.getCurrentSourceId(),
|
||||
maxSyncId: sql.getValue("SELECT MAX(id) FROM sync WHERE isSynced = 1")
|
||||
maxSyncId: sql.getValue("SELECT COALESCE(MAX(id), 0) FROM sync WHERE isSynced = 1")
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ function getStats() {
|
|||
function checkSync() {
|
||||
return {
|
||||
entityHashes: contentHashService.getEntityHashes(),
|
||||
maxSyncId: sql.getValue('SELECT MAX(id) FROM sync WHERE isSynced = 1')
|
||||
maxSyncId: sql.getValue('SELECT COALESCE(MAX(id), 0) FROM sync WHERE isSynced = 1')
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ function getChanged(req) {
|
|||
|
||||
const ret = {
|
||||
syncs: syncService.getSyncRecords(syncs),
|
||||
maxSyncId: sql.getValue('SELECT MAX(id) FROM sync WHERE isSynced = 1')
|
||||
maxSyncId: sql.getValue('SELECT COALESCE(MAX(id), 0) FROM sync WHERE isSynced = 1')
|
||||
};
|
||||
|
||||
if (ret.syncs.length > 0) {
|
||||
|
|
|
@ -23,7 +23,7 @@ function index(req, res) {
|
|||
treeFontSize: parseInt(options.treeFontSize),
|
||||
detailFontSize: parseInt(options.detailFontSize),
|
||||
sourceId: sourceIdService.generateSourceId(),
|
||||
maxSyncIdAtLoad: sql.getValue("SELECT MAX(id) FROM sync"),
|
||||
maxSyncIdAtLoad: sql.getValue("SELECT COALESCE(MAX(id), 0) FROM sync"),
|
||||
instanceName: config.General ? config.General.instanceName : null,
|
||||
appCssNoteIds: getAppCssNoteIds(),
|
||||
isDev: env.isDev(),
|
||||
|
|
|
@ -4,7 +4,7 @@ const build = require('./build');
|
|||
const packageJson = require('../../package');
|
||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
||||
|
||||
const APP_DB_VERSION = 161;
|
||||
const APP_DB_VERSION = 162;
|
||||
const SYNC_VERSION = 14;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
module.exports = { buildDate:"2020-07-11T23:58:59+02:00", buildRevision: "08edc521e48ea7c6de96c19290134b6552844313" };
|
||||
module.exports = { buildDate:"2020-07-31T23:34:05+02:00", buildRevision: "17d7ff3ff1bd50f272046864ca28e0ef407e24c9" };
|
||||
|
|
|
@ -123,7 +123,7 @@ async function doLogin() {
|
|||
}
|
||||
|
||||
async function pullSync(syncContext) {
|
||||
let appliedPulls = 0;
|
||||
let atLeastOnePullApplied = false;
|
||||
|
||||
while (true) {
|
||||
const lastSyncedPull = getLastSyncedPull();
|
||||
|
@ -150,10 +150,10 @@ async function pullSync(syncContext) {
|
|||
sql.transactional(() => {
|
||||
for (const {sync, entity} of rows) {
|
||||
if (!sourceIdService.isLocalSourceId(sync.sourceId)) {
|
||||
if (appliedPulls === 0 && sync.entity !== 'recent_notes') { // send only for first
|
||||
if (!atLeastOnePullApplied && sync.entity !== 'recent_notes') { // send only for first
|
||||
ws.syncPullInProgress();
|
||||
|
||||
appliedPulls++;
|
||||
atLeastOnePullApplied = true;
|
||||
}
|
||||
|
||||
syncUpdateService.updateEntity(sync, entity, syncContext.sourceId);
|
||||
|
@ -165,10 +165,10 @@ async function pullSync(syncContext) {
|
|||
setLastSyncedPull(rows[rows.length - 1].sync.id);
|
||||
});
|
||||
|
||||
log.info(`Pulled ${rows.length} changes in ${pulledDate - startDate}ms from ${changesUri} and applied them in ${Date.now() - pulledDate}ms`);
|
||||
log.info(`Pulled ${rows.length} changes starting at syncId=${lastSyncedPull} in ${pulledDate - startDate}ms and applied them in ${Date.now() - pulledDate}ms, ${stats.outstandingPulls} outstanding pulls`);
|
||||
}
|
||||
|
||||
if (appliedPulls > 0) {
|
||||
if (atLeastOnePullApplied) {
|
||||
ws.syncPullFinished();
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ function updatePushStats() {
|
|||
}
|
||||
|
||||
function getMaxSyncId() {
|
||||
return sql.getValue('SELECT MAX(id) FROM sync');
|
||||
return sql.getValue('SELECT COALESCE(MAX(id), 0) FROM sync');
|
||||
}
|
||||
|
||||
sqlInit.dbReady.then(() => {
|
||||
|
|
|
@ -82,7 +82,8 @@ function fillSyncRows(entityName, entityPrimaryKey, condition = '') {
|
|||
entityName: entityName,
|
||||
entityId: entityId,
|
||||
sourceId: "SYNC_FILL",
|
||||
utcSyncDate: dateUtils.utcNowDateTime()
|
||||
utcSyncDate: dateUtils.utcNowDateTime(),
|
||||
isSynced: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue