diff --git a/js/libtextsecure.js b/js/libtextsecure.js
index 86bc299a8..72592fb6e 100644
--- a/js/libtextsecure.js
+++ b/js/libtextsecure.js
@@ -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();
});
}
diff --git a/libtextsecure/api.js b/libtextsecure/api.js
index 1ba44d446..62bb8782b 100644
--- a/libtextsecure/api.js
+++ b/libtextsecure/api.js
@@ -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();
});
}
diff --git a/test/index.html b/test/index.html
index 3217171a6..4aa79da16 100644
--- a/test/index.html
+++ b/test/index.html
@@ -583,7 +583,6 @@
-