mirror of https://github.com/embarklabs/embark.git
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:
parent
095bd0b971
commit
edf43470e4
|
@ -151,6 +151,7 @@ class StorageProcessesLauncher {
|
||||||
self.logger.info(__(`Restarting ${storageName} process...`).cyan);
|
self.logger.info(__(`Restarting ${storageName} process...`).cyan);
|
||||||
self.processes[storageName].kill();
|
self.processes[storageName].kill();
|
||||||
delete this.processes[storageName];
|
delete this.processes[storageName];
|
||||||
|
self.launchProcess(storageName, callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.processes[storageName].on('result', constants.storage.exit, ({error}) => {
|
self.processes[storageName].on('result', constants.storage.exit, ({error}) => {
|
||||||
|
|
|
@ -87,7 +87,7 @@ class StorageProcessesLauncher {
|
||||||
}
|
}
|
||||||
if (this.restartCalled) {
|
if (this.restartCalled) {
|
||||||
this.restartCalled = false;
|
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}));
|
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.logger.info(__(`Restarting ${storageName} process...`).cyan);
|
||||||
self.processes[storageName].kill();
|
self.processes[storageName].kill();
|
||||||
delete this.processes[storageName];
|
delete this.processes[storageName];
|
||||||
|
self.launchProcess(storageName, callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.processes[storageName].on('result', constants.storage.exit, ({error}) => {
|
self.processes[storageName].on('result', constants.storage.exit, ({error}) => {
|
||||||
|
|
Loading…
Reference in New Issue