setTimeout/setImmediate workaround for linux hangs (#1497)

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-09-22 11:06:52 -07:00 committed by GitHub
parent 42f2142e36
commit 9db0cb49c4
3 changed files with 32 additions and 1 deletions

View file

@ -37666,8 +37666,22 @@ var TextSecureServer = (function() {
return true;
}
// On Linux/Electron multiple quick web requests can result in the Node.js event
// loop getting wedged. Bug: https://github.com/electron/electron/issues/10570
// This forces the event loop to move.
function scheduleHangWorkaround() {
setTimeout(function() {
setImmediate(function() {
// noop
});
}, 1000);
}
function createSocket(url) {
var requestOptions = { ca: window.config.certificateAuthorities };
scheduleHangWorkaround();
return new nodeWebSocket(url, null, null, null, requestOptions);
}
@ -37728,6 +37742,8 @@ var TextSecureServer = (function() {
reject(HTTPError(xhr.status, xhr.statusText, options.stack));
};
xhr.send( options.data || null );
scheduleHangWorkaround();
});
}

View file

@ -24,8 +24,22 @@ var TextSecureServer = (function() {
return true;
}
// On Linux/Electron multiple quick web requests can result in the Node.js event
// loop getting wedged. Bug: https://github.com/electron/electron/issues/10570
// This forces the event loop to move.
function scheduleHangWorkaround() {
setTimeout(function() {
setImmediate(function() {
// noop
});
}, 1000);
}
function createSocket(url) {
var requestOptions = { ca: window.config.certificateAuthorities };
scheduleHangWorkaround();
return new nodeWebSocket(url, null, null, null, requestOptions);
}
@ -86,6 +100,8 @@ var TextSecureServer = (function() {
reject(HTTPError(xhr.status, xhr.statusText, options.stack));
};
xhr.send( options.data || null );
scheduleHangWorkaround();
});
}

View file

@ -583,7 +583,6 @@
<script type="text/javascript" src="../js/storage.js" data-cover></script>
<script type="text/javascript" src="../js/signal_protocol_store.js" data-cover></script>
<script type="text/javascript" src="../js/libtextsecure.js" data-cover></script>
<script type="text/javascript" src="../js/backup.js" data-cover></script>
<script type="text/javascript" src="../js/libphonenumber-util.js"></script>
<script type="text/javascript" src="../js/models/messages.js" data-cover></script>