Workaround for circular connect (#73)

* Workaround for circular connect

* Upgrade dependencies
This commit is contained in:
Jaco Greeff
2018-04-23 10:38:42 +02:00
committed by GitHub
parent e0c336abe5
commit e71b11a13b
5 changed files with 65 additions and 91 deletions
+3 -3
View File
@@ -34,9 +34,9 @@
"nock": "^9.1.0"
},
"dependencies": {
"@polkadot/util": "^0.19.1",
"@polkadot/util-crypto": "^0.19.1",
"@polkadot/util-keyring": "^0.19.1",
"@polkadot/util": "^0.19.2",
"@polkadot/util-crypto": "^0.19.2",
"@polkadot/util-keyring": "^0.19.2",
"babel-runtime": "^6.26.0",
"isomorphic-fetch": "^2.2.1",
"websocket": "^1.0.25"
+4 -3
View File
@@ -5,8 +5,6 @@
import type { WsState } from './types';
const connect = require('./connect');
module.exports = function onClose (self: WsState): () => void {
return (): void => {
self.l.debug(() => ['disconnected from', self.endpoint]);
@@ -14,7 +12,10 @@ module.exports = function onClose (self: WsState): () => void {
self.isConnected = false;
if (self.autoConnect) {
setTimeout(() => connect(self), 1000);
setTimeout(() => {
// FIXME: This is a circular dependency
require('./connect')(self);
}, 1000);
}
};
};