Unverified Commit 32a836b4 authored by Axel Chalon's avatar Axel Chalon
Browse files

Wait longer before trying to connect to IPC

parent 3b5ba26c
Pipeline #149642 failed with stage
......@@ -24,6 +24,8 @@ class IpcChannel extends EventEmitter {
init (path) {
return new Promise((resolve, reject) => {
pino.info('Connecting to IPC socket...');
const socket = net.createConnection(path);
socket.on('connect', () => {
pino.info('Connected to IPC socket.');
......
......@@ -3,6 +3,8 @@
//
// SPDX-License-Identifier: BSD-3-Clause
import fs from 'fs';
import { runParity } from '@parity/electron';
import { bundledParityPath, BUNDLED_IPC_PATH } from '../utils/paths';
......@@ -13,6 +15,10 @@ import Pino from '../utils/pino';
const pino = Pino();
function wait (milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
class ParityEthereum {
constructor () {
if (cli.ipcPath) {
......@@ -25,12 +31,12 @@ class ParityEthereum {
// Run the bundled Parity Ethereum
return this.run()
.then(
_ =>
new Promise((resolve, reject) => {
setTimeout(resolve, 1000); // delay is needed to give time for the ipc file to be set up
})
)
.then(async _ => {
// wait for the ipc socket file to be set up
do {
await wait(200);
} while (!fs.existsSync(BUNDLED_IPC_PATH));
})
.then(() => ipcChannel.init(BUNDLED_IPC_PATH))
.catch(handleError);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment