mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 07:45:51 +01:00
opening transactions only on write operations which enforces exclusive lock only there to improve concurrency, custom handling of sync request timeouts, #1093, #1018
This commit is contained in:
@@ -70,7 +70,7 @@ async function sync() {
|
||||
};
|
||||
}
|
||||
else {
|
||||
log.info("sync failed: " + e.message + e.stack);
|
||||
log.info("sync failed: " + e.message + "\nstack: " + e.stack);
|
||||
|
||||
return {
|
||||
success: false,
|
||||
@@ -97,7 +97,6 @@ async function doLogin() {
|
||||
const hash = utils.hmac(documentSecret, timestamp);
|
||||
|
||||
const syncContext = { cookieJar: {} };
|
||||
|
||||
const resp = await syncRequest(syncContext, 'POST', '/api/login/sync', {
|
||||
timestamp: timestamp,
|
||||
syncVersion: appInfo.syncVersion,
|
||||
@@ -259,14 +258,18 @@ async function checkContentHash(syncContext) {
|
||||
}
|
||||
|
||||
async function syncRequest(syncContext, method, requestPath, body) {
|
||||
return await request.exec({
|
||||
const timeout = await syncOptions.getSyncTimeout();
|
||||
|
||||
const opts = {
|
||||
method,
|
||||
url: await syncOptions.getSyncServerHost() + requestPath,
|
||||
cookieJar: syncContext.cookieJar,
|
||||
timeout: await syncOptions.getSyncTimeout(),
|
||||
timeout: timeout,
|
||||
body,
|
||||
proxy: proxyToggle ? await syncOptions.getSyncProxy() : null
|
||||
});
|
||||
};
|
||||
|
||||
return await utils.timeLimit(request.exec(opts), timeout);
|
||||
}
|
||||
|
||||
const primaryKeys = {
|
||||
@@ -380,4 +383,4 @@ module.exports = {
|
||||
getSyncRecords,
|
||||
stats,
|
||||
getMaxSyncId
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user