Merge pull request #2251 from mempool/nymkappa/bugfix/clightning-crash

Don't throw an exception when cln connection is down
This commit is contained in:
wiz authored and GitHub committed 2022-08-08 17:28:50 +09:00
commit 9075651897
2 files changed
+16 -5

No files matched your search

@@ -157,8 +157,18 @@ export default class CLightningClient extends EventEmitter implements AbstractLi
const _self = this;
this.client = createConnection(rpcPath);
this.rl = createInterface({ input: this.client })
this.client = createConnection(rpcPath).on(
'error', () => {
_self.increaseWaitTime();
_self.reconnect();
}
);
this.rl = createInterface({ input: this.client }).on(
'error', () => {
_self.increaseWaitTime();
_self.reconnect();
}
);
this.clientConnectionPromise = new Promise<void>(resolve => {
_self.client.on('connect', () => {
@@ -175,7 +185,6 @@ export default class CLightningClient extends EventEmitter implements AbstractLi
_self.client.on('error', error => {
logger.err(`[CLightningClient] Lightning client connection error: ${error}`);
_self.emit('error', error);
_self.increaseWaitTime();
_self.reconnect();
});