Permalink
Browse files

setTimeout/setImmediate workaround for linux hangs (#1497)

FREEBIE
  • Loading branch information...
scottnonnenberg committed Sep 22, 2017
1 parent 42f2142 commit 9db0cb49c4a98a25a3ffb74fb8334a8e1f23e1b2
Showing with 32 additions and 1 deletion.
  1. +16 −0 js/libtextsecure.js
  2. +16 −0 libtextsecure/api.js
  3. +0 −1 test/index.html
View
@@ -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
@@ -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
@@ -583,7 +583,6 @@ <h3>{{ message }}</h3>
<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>

0 comments on commit 9db0cb4

Please sign in to comment.