experimental implementation of sync toggle

This commit is contained in:
azivner 2017-11-16 20:08:04 -05:00
parent 7e3fd2f63e
commit 9e7fcdfe15

View file

@ -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;
}