From edf43470e4adaf6c046fb747925919b8f8939416 Mon Sep 17 00:00:00 2001 From: emizzle Date: Wed, 26 Feb 2020 19:04:02 +1100 Subject: [PATCH] fix(@embark/storage): Fix hang when changing environments Fix an issue with storage process launcher hanging when changing environments. This occurred most frequently when the IPFS process was forced to restart due to the change in environment. Change in enviroment can be considered: 1. `embark run env1` 2. `Ctrl+c` 3. `embark run env2` --- packages/plugins/ipfs/src/storageProcessesLauncher.js | 1 + packages/plugins/swarm/src/storageProcessesLauncher.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/plugins/ipfs/src/storageProcessesLauncher.js b/packages/plugins/ipfs/src/storageProcessesLauncher.js index 8920373cf..2aa767f37 100644 --- a/packages/plugins/ipfs/src/storageProcessesLauncher.js +++ b/packages/plugins/ipfs/src/storageProcessesLauncher.js @@ -151,6 +151,7 @@ class StorageProcessesLauncher { self.logger.info(__(`Restarting ${storageName} process...`).cyan); self.processes[storageName].kill(); delete this.processes[storageName]; + self.launchProcess(storageName, callback); }); self.processes[storageName].on('result', constants.storage.exit, ({error}) => { diff --git a/packages/plugins/swarm/src/storageProcessesLauncher.js b/packages/plugins/swarm/src/storageProcessesLauncher.js index c487fbc7c..2c7f78083 100644 --- a/packages/plugins/swarm/src/storageProcessesLauncher.js +++ b/packages/plugins/swarm/src/storageProcessesLauncher.js @@ -87,7 +87,7 @@ class StorageProcessesLauncher { } if (this.restartCalled) { this.restartCalled = false; - return this.launchProcess(storageName, () => {}); + return; } this.logger.error(__(`Storage process for {{storageName}} ended before the end of this process. Code: {{code}}`, {storageName, code})); } @@ -150,6 +150,7 @@ class StorageProcessesLauncher { self.logger.info(__(`Restarting ${storageName} process...`).cyan); self.processes[storageName].kill(); delete this.processes[storageName]; + self.launchProcess(storageName, callback); }); self.processes[storageName].on('result', constants.storage.exit, ({error}) => {