mirror of
https://github.com/zadam/trilium.git
synced 2024-12-27 01:34:05 +08:00
experimental implementation of sync toggle
This commit is contained in:
parent
7e3fd2f63e
commit
9e7fcdfe15
1 changed files with 4 additions and 1 deletions
|
@ -17,6 +17,7 @@ const SYNC_TIMEOUT = config['Sync']['syncServerTimeout'] || 5000;
|
|||
const SYNC_PROXY = config['Sync']['syncProxy'];
|
||||
|
||||
let syncInProgress = false;
|
||||
let proxyToggle = true;
|
||||
|
||||
async function sync() {
|
||||
if (syncInProgress) {
|
||||
|
@ -53,6 +54,8 @@ async function sync() {
|
|||
};
|
||||
}
|
||||
catch (e) {
|
||||
proxyToggle = !proxyToggle;
|
||||
|
||||
if (e.message.indexOf('ECONNREFUSED') !== -1) {
|
||||
log.info("No connection to sync server.");
|
||||
|
||||
|
@ -225,7 +228,7 @@ async function syncRequest(syncContext, method, uri, body) {
|
|||
timeout: SYNC_TIMEOUT
|
||||
};
|
||||
|
||||
if (SYNC_PROXY) {
|
||||
if (SYNC_PROXY && proxyToggle) {
|
||||
options.proxy = SYNC_PROXY;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue