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`
This commit is contained in:
emizzle 2020-02-26 19:04:02 +11:00 committed by Pascal Precht
parent 095bd0b971
commit edf43470e4
2 changed files with 3 additions and 1 deletions

View File

@ -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}) => {

View File

@ -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}) => {