Skip to content

Commit

Permalink
fix(@embark/storage): Fix hang when changing environments
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
emizzle authored and 0x-r4bbit committed Mar 23, 2020
1 parent 095bd0b commit edf4347
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/plugins/ipfs/src/storageProcessesLauncher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/plugins/swarm/src/storageProcessesLauncher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}));
}
Expand Down Expand Up @@ -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}) => {
Expand Down

0 comments on commit edf4347

Please sign in to comment.