mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +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:
@@ -217,6 +217,24 @@ function formatDownloadTitle(filename, type, mime) {
|
||||
}
|
||||
}
|
||||
|
||||
function timeLimit(promise, limitMs) {
|
||||
return new Promise((res, rej) => {
|
||||
let resolved = false;
|
||||
|
||||
promise.then(() => {
|
||||
resolved = true;
|
||||
|
||||
res();
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
if (!resolved) {
|
||||
rej(new Error('Process exceeded time limit ' + limitMs));
|
||||
}
|
||||
}, limitMs);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
randomSecureToken,
|
||||
randomString,
|
||||
@@ -245,5 +263,6 @@ module.exports = {
|
||||
isStringNote,
|
||||
quoteRegex,
|
||||
replaceAll,
|
||||
formatDownloadTitle
|
||||
formatDownloadTitle,
|
||||
timeLimit
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user